【问题标题】:In-App purchase on iOS simulator causes .../usr/libexec/lsd to crashiOS 模拟器上的应用内购买导致 .../usr/libexec/lsd 崩溃
【发布时间】:2012-09-28 22:15:55
【问题描述】:

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

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 后的新问题。它曾经在以前的版本中运行良好。

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

【问题讨论】:

  • 它在 Xcode 4.5 的 beta 版本上运行正常。不过没有在 GM 上测试。
  • 我在启动时也看到了这个错误,只有一个我正在开发的应用程序......它不使用应用内购买。如果我发现任何细节,我会添加更多详细信息。
  • 如果不查看导致崩溃的实际代码,很难给出答案,但是,看看下面的内容是否能给你一个线索;这个“objc_msgSend() 选择器名称:释放”表明应用程序正在尝试释放一个很可能已经被释放的对象,或者其相应的地址不再有效,或者该对象将被自动释放等,这就是为什么'EXC_BAD_ACCESS (SIGBUS)' 异常。
  • 有完全相同的崩溃。这是由SKProductsRequest 引起的。当我将此注释掉时,lsd 不会再在模拟器上崩溃。
  • 我也看到了。如果我注释掉 SKProductsRequest.Start 调用,它不会崩溃。但是,另一个与我配置完全相同的开发人员没有看到这个问题。

标签: ios-simulator in-app-purchase ios6


【解决方案1】:

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

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

【讨论】:

  • 您还需要使用临时/生产配置。开发配置不支持应用内购买测试(即使使用沙盒商店)。
  • 那么解决方案是在应用程序中的所有 storekit 访问周围添加#if IPHONE_SIMULATOR 吗?
【解决方案2】:

确认 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
}

【讨论】:

    猜你喜欢
    • 2016-03-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多