我一直在与我的应用程序用户合作,该用户在启动应用程序时遇到崩溃。我们认为它与应用内购买过程有关,但我无法诊断原因,所以我想我会把它带到这里(对于我与之交谈过的所有其他用户,一切似乎都在工作正好)。
回到有问题的用户,她说自从她购买 IAP 后,应用程序在启动时就崩溃了。并且在崩溃之后,设备经常提示用户输入她的用户 ID 和密码(就好像它正在尝试再次购买一样)。我们已经尝试重新安装应用程序,更新到 iOS 7,更新应用程序本身......没有运气。
她很好地给我发了一些崩溃日志,我在下面复制了这些日志。任何输入将不胜感激!
如果有帮助,我在 iOS 6 教程中遵循了 Ray Wenderlich 的 IAP……再说一次,除此之外没有报告其他问题,这让我想知道在购买过程中是否有问题。
Incident Identifier: 1E0C36A9-C7EC-48D7-9BB8-D56F6203D62E
CrashReporter Key: 2ac3185fb0d2c64d11247cccfa4a55af32fd5462
Hardware Model: iPhone4,1
Process: MetricMe [9322]
Path: /var/mobile/Applications/847DC898-FD57-40F5-98F2-6C361DC7DECC/MetricMe.app/MetricMe
Identifier: com.anthonydubis.metricme
Version: 3.0.5 (3.0.5)
Code Type: ARM (Native)
Parent Process: launchd [1]
Date/Time: 2013-10-04 13:48:13.129 -0400
OS Version: iOS 7.0.2 (11A501)
Report Version: 104
Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Triggered by Thread: 0
Last Exception Backtrace:
0 CoreFoundation 0x2ebf9f4e __exceptionPreprocess + 126
1 libobjc.A.dylib 0x38fd26aa objc_exception_throw + 34
2 CoreFoundation 0x2eb37c12 -[__NSSetM addObject:] + 558
3 MetricMe 0x00069fc4 -[IAPHelper provideContentForRestoredProductIdentifier:] (IAPHelper.m:172)
4 MetricMe 0x00069ce8 -[IAPHelper restoreTransaction:] (IAPHelper.m:146)
5 MetricMe 0x00069b14 -[IAPHelper paymentQueue:updatedTransactions:] (IAPHelper.m:124)
6 StoreKit 0x312fddc8 __NotifyObserverAboutChanges + 80
7 CoreFoundation 0x2eb2d714 CFArrayApplyFunction + 32
8 StoreKit 0x312fdd64 -[SKPaymentQueue _notifyObserversAboutChanges:sendUpdatedDownloads:] + 124
9 StoreKit 0x312fe646 -[SKPaymentQueue _processUpdates:trimUnmatched:sendUpdatedDownloads:] + 1022
10 StoreKit 0x312fed1c -[SKPaymentQueue _setTransactionsWithReply:] + 124
11 StoreKit 0x312fd906 __38-[SKPaymentQueue _establishConnection]_block_invoke_2 + 58
12 libdispatch.dylib 0x394b5d76 _dispatch_call_block_and_release + 6
13 libdispatch.dylib 0x394b5d62 _dispatch_client_callout + 18
14 libdispatch.dylib 0x394bc7bc _dispatch_main_queue_callback_4CF$VARIANT$mp + 264
15 CoreFoundation 0x2ebc481c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 4
16 CoreFoundation 0x2ebc30f0 __CFRunLoopRun + 1296
17 CoreFoundation 0x2eb2dce2 CFRunLoopRunSpecific + 518
18 CoreFoundation 0x2eb2dac6 CFRunLoopRunInMode + 102
19 GraphicsServices 0x3384e27e GSEventRunModal + 134
20 UIKit 0x313cfa3c UIApplicationMain + 1132
21 MetricMe 0x00043842 main (main.m:16)
22 libdyld.dylib 0x394daab2 tlv_initializer + 2
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x395911fc __pthread_kill + 8
1 libsystem_pthread.dylib 0x395faa2e pthread_kill + 54
2 libsystem_c.dylib 0x39541ff8 abort + 72
3 libc++abi.dylib 0x38870cd2 abort_message + 70
4 libc++abi.dylib 0x388896e0 default_terminate_handler() + 248
5 libobjc.A.dylib 0x38fd291e _objc_terminate() + 190
6 libc++abi.dylib 0x388871c4 std::__terminate(void (*)()) + 76
7 libc++abi.dylib 0x38886a18 __cxa_throw + 112
8 libobjc.A.dylib 0x38fd277e objc_exception_throw + 246
9 CoreFoundation 0x2eb37c12 -[__NSSetM addObject:] + 558
10 MetricMe 0x00069fc4 -[IAPHelper provideContentForRestoredProductIdentifier:] (IAPHelper.m:172)
11 MetricMe 0x00069ce8 -[IAPHelper restoreTransaction:] (IAPHelper.m:146)
12 MetricMe 0x00069b14 -[IAPHelper paymentQueue:updatedTransactions:] (IAPHelper.m:124)
13 StoreKit 0x312fddc8 __NotifyObserverAboutChanges + 80
14 CoreFoundation 0x2eb2d716 CFArrayApplyFunction + 34
15 StoreKit 0x312fdd64 -[SKPaymentQueue _notifyObserversAboutChanges:sendUpdatedDownloads:] + 124
16 StoreKit 0x312fe646 -[SKPaymentQueue _processUpdates:trimUnmatched:sendUpdatedDownloads:] + 1022
17 StoreKit 0x312fed1c -[SKPaymentQueue _setTransactionsWithReply:] + 124
18 StoreKit 0x312fd906 __38-[SKPaymentQueue _establishConnection]_block_invoke_2 + 58
19 libdispatch.dylib 0x394b5d78 _dispatch_call_block_and_release + 8
20 libdispatch.dylib 0x394b5d64 _dispatch_client_callout + 20
21 libdispatch.dylib 0x394bc7bc _dispatch_main_queue_callback_4CF$VARIANT$mp + 264
22 CoreFoundation 0x2ebc481c __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 4
23 CoreFoundation 0x2ebc30f0 __CFRunLoopRun + 1296
24 CoreFoundation 0x2eb2dce2 CFRunLoopRunSpecific + 518
25 CoreFoundation 0x2eb2dac6 CFRunLoopRunInMode + 102
26 GraphicsServices 0x3384e27e GSEventRunModal + 134
27 UIKit 0x313cfa3c UIApplicationMain + 1132
28 MetricMe 0x00043842 main (main.m:16)
29 libdyld.dylib 0x394daab4 start + 0
编辑添加 IAPHelper 的第 172 行:
它在产品还原期间调用并传入 IAP 的 productIdentifier。有趣的是,这发生在应用程序启动时,这让我想知道这是否是在 IAP 购买过程中互联网连接丢失的情况,现在它正试图在启动时恢复它。
IAPHelper 包含许多购买和恢复产品的方法(也是购买通知的观察者)。在 applicationDidFinishLaunching 中调用 sharedInstance 以便它准备好接收来自 Apple 的收据。第 172 行是将产品标识符添加到 _purchasedProductIdentifiers 的位置,这是一个 NSMutableSet 实例变量。该错误是否暗示 _purchasedProductIdentifiers 有问题(NSMutable 集应在到达此处之前初始化)或传入的 productIdentifier?在实践中,除非创建了 IAPHelper 的 sharedInstance,否则我们永远不会达到这一点,这是创建 _purchasedProductIdentifiers 的地方。
- (void)provideContentForRestoredProductIdentifier:(NSString *)productIdentifier
{
[_purchasedProductIdentifiers addObject:productIdentifier];
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:productIdentifier];
[[NSUserDefaults standardUserDefaults] synchronize];
[[NSNotificationCenter defaultCenter] postNotificationName:IAPHelperProductRestoredNotification object:productIdentifier userInfo:nil];
}