3
我正在使用最新的MKStoreKit进行应用内购买。我遇到的问题是,当应用程序启动时没有互联网时,产品不会从应用商店加载。如果我再运行MKStoreKit没有互联网连接
- (void) buyFeature:(NSString*) featureId
onComplete:(void (^)(NSString* purchasedFeature, NSData*purchasedReceipt)) completionBlock
onCancelled:(void (^)(void)) cancelBlock;
然后,它从来没有运行任何的onComplete或onCancelled因为它返回这里时,没有找到购买对象。
NSArray *allIds = [self.purchasableObjects valueForKey:@"productIdentifier"];
int index = [allIds indexOfObject:productId];
if(index == NSNotFound) return; <-- IT RETURNS HERE
SKProduct *thisProduct = [self.purchasableObjects objectAtIndex:index];
SKPayment *payment = [SKPayment paymentWithProduct:thisProduct];
[[SKPaymentQueue defaultQueue] addPayment:payment];
它甚至不发回错误,所以用户不会收到任何消息。
我想这应该是一个常见问题?我如何以最佳方式处理它?