In app purchase payment queue update - application crash
In app purchase payment queue update - application crash
- Subject: In app purchase payment queue update - application crash
- From: Sasikumar JP <email@hidden>
- Date: Tue, 03 Mar 2015 21:03:38 +0530
Hi,
I am having a problem with payment queue update during the application
launch only on app store version. i could not reproduce the issue on
development version.
I have captured the crash report from Crashlytics
Thread : Crashed: com.apple.main-thread
0 JPStoreKit 0x00000001007edf54
JPStoreKit.JPInAppPurchaseHandler.paymentQueue
(JPStoreKit.JPInAppPurchaseHandler)(Swift.ImplicitlyUnwrappedOptional<ObjectiveC.SKPaymentQueue>,
updatedTransactions :
Swift.ImplicitlyUnwrappedOptional<Swift.Array<Swift.AnyObject>>) -> ()
(JPInAppPurchaseHandler.swift)
1 JPStoreKit 0x00000001007ed8f0
JPStoreKit.JPInAppPurchaseHandler.paymentQueue
(JPStoreKit.JPInAppPurchaseHandler)(Swift.ImplicitlyUnwrappedOptional<ObjectiveC.SKPaymentQueue>,
updatedTransactions :
Swift.ImplicitlyUnwrappedOptional<Swift.Array<Swift.AnyObject>>) -> ()
(JPInAppPurchaseHandler.swift)
2 JPStoreKit 0x00000001007edffc @objc
JPStoreKit.JPInAppPurchaseHandler.paymentQueue
(JPStoreKit.JPInAppPurchaseHandler)(Swift.ImplicitlyUnwrappedOptional<ObjectiveC.SKPaymentQueue>,
updatedTransactions :
Swift.ImplicitlyUnwrappedOptional<Swift.Array<Swift.AnyObject>>) -> ()
(JPInAppPurchaseHandler.swift)
3 StoreKit 0x0000000189e24ddc
__NotifyObserverAboutChanges + 112
4 CoreFoundation 0x00000001855f8aac CFArrayApplyFunction +
68
5 StoreKit 0x0000000189e24d50 -[SKPaymentQueue
_notifyObserversAboutChanges:sendUpdatedDownloads:] + 156
6 StoreKit 0x0000000189e25938 -[SKPaymentQueue
_processUpdates:trimUnmatched:sendUpdatedDownloads:] + 1348
7 StoreKit 0x0000000189e26208 -[SKPaymentQueue
_setTransactionsWithReply:] + 208
8 StoreKit 0x0000000189e24794 __38-[SKPaymentQueue
_establishConnection]_block_invoke_2 + 68
9 libdispatch.dylib 0x00000001964a53ac
_dispatch_call_block_and_release
10 libdispatch.dylib 0x00000001964a536c
_dispatch_client_callout
11 libdispatch.dylib 0x00000001964a9980
_dispatch_main_queue_callback_4CF
12 CoreFoundation 0x00000001856cdfa4
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
13 CoreFoundation 0x00000001856cc04c __CFRunLoopRun + 1492
14 CoreFoundation 0x00000001855f90a4 CFRunLoopRunSpecific +
396
15 GraphicsServices 0x000000018e7935a4 GSEventRunModal + 168
16 UIKit 0x0000000189f2aaa4 UIApplicationMain +
1488
17 INDRadio 0x000000010002c920 main
(AppDelegate.swift:14)
18 libdyld.dylib 0x00000001964cea08 start + 4
Here is the code which handles the payment Queue update transaction.
//MARK:
//MARK: SKPaymentTransactionObserver Methods
public func paymentQueue(queue: SKPaymentQueue!, updatedTransactions
transactions: [AnyObject]!) {
for transaction in transactions as [SKPaymentTransaction] {
// Get the inAppProduct for this transaction
var inAppProduct = getProductWithProductId(transaction.payment.
productIdentifier)
switch transaction.transactionState {
case SKPaymentTransactionState.Purchasing:
inAppProduct?.purchaseStatus = InAppPurchaseQueueStatus.
Purchasing
println("Purchasing")
case SKPaymentTransactionState.Deferred:
inAppProduct?.purchaseStatus = InAppPurchaseQueueStatus.
Deferred
println("Deferred")
case SKPaymentTransactionState.Purchased:
println("Purchased")
SKPaymentQueue.defaultQueue().finishTransaction(transaction)
if validatePurchaseWithProductId(inAppProduct!.productId,
bundleId: inAppProduct!.bundleId, bundleVersion: inAppProduct!.bundleVersion)
{
inAppProduct?.purchaseStatus = InAppPurchaseQueueStatus.
Purchased
} else {
inAppProduct?.purchaseStatus = InAppPurchaseQueueStatus.
Failed
}
case SKPaymentTransactionState.Restored:
println("restored")
if validatePurchaseWithProductId(inAppProduct!.productId,
bundleId: inAppProduct!.bundleId, bundleVersion: inAppProduct!.bundleVersion)
{
inAppProduct?.purchaseStatus = InAppPurchaseQueueStatus.
Restored
restoreStatus = InAppPurchaseRestoreStatus.Restored
} else {
inAppProduct?.purchaseStatus = InAppPurchaseQueueStatus.
Failed
restoreStatus = InAppPurchaseRestoreStatus.RestoreFailed
}
SKPaymentQueue.defaultQueue().finishTransaction(transaction)
case SKPaymentTransactionState.Failed:
inAppProduct?.purchaseStatus = InAppPurchaseQueueStatus.
Failed
println("failed")
SKPaymentQueue.defaultQueue().finishTransaction(transaction)
}
postQueueStatusChangeNotification()
}
}
I could not figure which statement in this function makes the application
to crash.
crash report shows only the function signature which takes 2
ImplicitlyUnWrapped Parameters. not sure this function parameter itself
passed with nil value.
public func paymentQueue(queue: SKPaymentQueue!, updatedTransactions
transactions: [AnyObject]!)
Please help me to identify the real cause of the application crash
Regards
Sasikumar JP
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden