5

在模拟器中测试应用内购买时,出现以下崩溃:

Path:            /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/usr/libexec/lsd
Parent Process:  launchd [166]

Crashed Thread:  0  Dispatch queue: com.apple.main-thread

Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x0000000000000030

VM Regions Near 0x975c08c:
    MALLOC_SMALL           0000000002000000-0000000004000000 [ 32.0M] rw-/rwx SM=PRV  
--> 
    __TEXT                 000000008fed8000-000000008ff0b000 [  204K] r-x/rwx SM=COW  /usr/lib/dyld

Application Specific Information:
objc_msgSend() selector name: release
iPhone Simulator 358.4, iPhone OS 6.0 (iPhone/10A403)



Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib                 0x0073509b objc_msgSend + 15
1   CoreFoundation                  0x0098841c CFRelease + 108
2   MobileCoreServices              0x003f3fac _LSServer_CopyVendorIdentifier + 1320
3   MobileCoreServices              0x0040d912 _LSPluginServer_GetVendorIdentifierForAppIdentifier + 311
4   MobileCoreServices              0x004120bb _XGetVendorIdentifierForAppIdentifier + 238
5   MobileCoreServices              0x0041224d LSPlugin_server + 119
6   MobileCoreServices              0x0041e6e8 serverCallback + 154
7   CoreFoundation                  0x00981c93 __CFMachPortPerform + 131
8   CoreFoundation                  0x00981bf5 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
9   CoreFoundation                  0x00981962 __CFRunLoopDoSource1 + 146
10  CoreFoundation                  0x009b2bb6 __CFRunLoopRun + 2118
11  CoreFoundation                  0x009b1f44 CFRunLoopRunSpecific + 276
12  CoreFoundation                  0x009bdf91 CFRunLoopRun + 129
13  MobileCoreServices              0x0041e638 _LSServerMain + 360
14  lsd                             0x00001aa6 0x1000 + 2726
15  lsd                             0x00001a41 0x1000 + 2625

Thread 1:: Dispatch queue: com.apple.libdispatch-manager
0   libsystem_kernel.dylib          0x96f2b926 kevent64 + 10
1   libdispatch.dylib               0x01102c2b _dispatch_mgr_invoke + 863
2   libdispatch.dylib               0x011028cc _dispatch_mgr_thread + 61

Thread 2:
0   libsystem_kernel.dylib          0x96f2b02e __workq_kernreturn + 10
1   libsystem_c.dylib               0x9ae3fccf _pthread_wqthread + 773
2   libsystem_c.dylib               0x9ae416fe start_wqthread + 30

Thread 0 crashed with X86 Thread State (32-bit):
  eax: 0x8fef2b02  ebx: 0x009883be  ecx: 0x0073c2c4  edx: 0x0975c084
  edi: 0x8fef2b02  esi: 0x00187d83  ebp: 0xbfffe758  esp: 0xbfffe6f8
   ss: 0x00000023  efl: 0x00010282  eip: 0x0073509b   cs: 0x0000001b
   ds: 0x00000023   es: 0x00000023   fs: 0x00000000   gs: 0x0000000f

模拟器继续运行,但应用内购买不会在模拟器上的任何地方进行。手机上的相同代码运行正常。

这个问题是升级到 Xcode 4.5.1 后的新问题。它曾经在以前的版本中运行良好。

有人遇到这个问题或知道解决方案吗?

4

2 回答 2

3

直接来自 iOS 6.0 SDK 发行说明:

对于此版本,iOS 模拟器不支持测试应用内购买。请使用设备测试使用此功能的应用。

于 2012-10-20T00:12:56.097 回答
1

确认 StoreKit 调用导致 lsd 错误。

这是我的解决方案,它使我所有的 lsd 错误都消失了:

#import <TargetConditionals.h>
- (Result *) whateverStoreKitCallingFunction
{
#if TARGET_IPHONE_SIMULATOR
    return nil;    
#else // TARGET_IPHONE_SIMULATOR
    // Do whatever normal storekit calls
    return "whatever";
#endif // TARGET_IPHONE_SIMULATOR
}
于 2012-11-19T20:39:00.143 回答