We have been testing our app compiled using Xcode 6.4 on a iOS 9 iPhone 6 and we have an unexplainable crash when completing an in-app purchase.
When calling finishTransaction:
in the paymentQueue:updatedTransactions:
callback, we have this crash:
#0 0x0000000199eb8158 in objc_release ()
#1 0x0000000100cfc1d8 in +[TLStoreKitSource tlsw_finishTransaction:] ()
#2 0x0000000100402914 in -[InAppPurchaseHelper paymentQueue:updatedTransactions:] at VDPremiumSettingsWebViewController.m:105
#3 0x000000018a7746cc in __NotifyObserverAboutChanges ()
#4 0x00000001851947ec in CFArrayApplyFunction ()
#5 0x000000018a774648 in -[SKPaymentQueue _notifyObserversAboutChanges:sendUpdatedDownloads:] ()
#6 0x000000018a775150 in -[SKPaymentQueue _processUpdates:trimUnmatched:sendUpdatedDownloads:] ()
#7 0x000000018a775c58 in -[SKPaymentQueue _updatePaymentsForMessage:] ()
#8 0x000000018a7744f8 in __44-[SKPaymentQueue _handleMessage:connection:]_block_invoke ()
#9 0x00000001022a5d70 in _dispatch_call_block_and_release ()
#10 0x00000001022a5d30 in _dispatch_client_callout ()
#11 0x00000001022ab780 in _dispatch_main_queue_callback_4CF ()
#12 0x0000000185268258 in __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ ()
#13 0x00000001852660c0 in __CFRunLoopRun ()
#14 0x0000000185194dc0 in CFRunLoopRunSpecific ()
#15 0x00000001902e8088 in GSEventRunModal ()
#16 0x000000018a86ef60 in UIApplicationMain ()
#17 0x000000010006c338 in main at main.m:17
#18 0x000000019a6ca8b8 in start ()
Enqueued from com.apple.root.default-qos.overcommit (Thread 16)Queue : com.apple.root.default-qos.overcommit (serial)
#0 0x00000001022b032c in _dispatch_barrier_async_f ()
#1 0x000000018a77444c in -[SKPaymentQueue _handleMessage:connection:] ()
#2 0x000000019a8e130c in _xpc_connection_call_event_handler ()
#3 0x000000019a8df0b4 in _xpc_connection_mach_event ()
#4 0x00000001022a5e2c in _dispatch_client_callout4 ()
#5 0x00000001022aa39c in _dispatch_mach_msg_invoke ()
#6 0x00000001022b2a0c in _dispatch_queue_drain ()
#7 0x00000001022a93fc in _dispatch_mach_invoke ()
#8 0x00000001022a5d30 in _dispatch_client_callout ()
#9 0x00000001022b4f38 in _dispatch_root_queue_drain ()
#10 0x00000001022b4600 in _dispatch_worker_thread3 ()
#11 0x000000019a8ad478 in _pthread_wqthread ()
#12 0x000000019a8ad028 in start_wqthread ()
I do not think that this issue is specifically in StoreKit, because purchase works well on a sample code. I suspect a nasty side-effect from our part.
I think that finding which object objc_release
is called upon may solve the problem. However, I do not know how to find this using assembly code.
Does someone have encountered this crash? Any hints on how to find where the problem comes from?
For info, here is the callback code:
- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions {
for (SKPaymentTransaction *transaction in transactions) {
switch (transaction.transactionState) {
case SKPaymentTransactionStatePurchasing:
break;
case SKPaymentTransactionStateFailed:
if (self.purchaseErrorBlock) {
self.purchaseErrorBlock(transaction.error);
}
[queue finishTransaction:transaction];
break;
case SKPaymentTransactionStatePurchased:
if (self.purchaseSuccessBlock) {
self.purchaseSuccessBlock();
}
[queue finishTransaction:transaction];
break;
case SKPaymentTransactionStateDeferred:
[queue finishTransaction:transaction];
break;
case SKPaymentTransactionStateRestored:
[queue finishTransaction:transaction];
break;
}
}
}