I recently had an update to an app approved. This versioned added In app purchases. The app works perfect in sandbox mode and Apple did approve both the IAP and the app, but the in app purchases fails in the app.
I think the crash occurs because the response.products from:
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
}
returns an empty array and that:
SKProduct *product = [[products filteredArrayUsingPredicate:[NSPredicate
predicateWithFormat:@"productIdentifier == %@", _model.packageId]] firstObject];
returns nil. I can't get the price of the SKProduct. I think that the actual app crash is with these lines since product and payment probably is nil.
SKPayment *payment = [SKPayment paymentWithProduct:product];
[[SKPaymentQueue defaultQueue] addPayment:payment];
I read other blog posts that it can take up to 24 hours before IAP becomes available. Is this true? Do I need to worry about bugs regarding the IAP's in my app when it works in sandbox mode and that Apple approved it?
It turned out that this is indeed an Apple problem. I got a response from Apple stating that it can take up to 36 hours before the In App Purchases is available.
I guess this makes it really important to handle the case when
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
}
is called, but when response.products is empty. When you try to get the actual product, make sure that you don't get a nil result.
I wish that Apple would not approve and release an update of an app until the IAP was really ready for sale.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With