我在应用程序中购买了三个应用程序。第一个工作正常,超过一年。我有这个例行程序:
-(void)purchaseProUpgrade{
SKPayment *payment = [SKPayment paymentWithProductIdentifier: inAppProductId];
if ([SKPaymentQueue canMakePayments]) [[SKPaymentQueue defaultQueue] addPayment:payment];
else [self purchaseFailedWithError:nil];
}
但是paymentWithProductIdentifier已经过折旧。所以在接下来的两个应用程序中,我将其更改为(其余代码相同):
-(void)purchaseProUpgrade{
SKPayment *payment =[SKPayment paymentWithProduct: self.upgradeProduct];
if ([SKPaymentQueue canMakePayments]) [[SKPaymentQueue defaultQueue] addPayment:payment];
else [self purchaseFailedWithError:nil];
}
其中“upgradeProduct”由
设置- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
NSArray *products = response.products;
if([products count]>0) self.upgradeProduct = products[0];
// the user is warned if upgradeProduct not is set
}
// upgradeProduct is declared as Strong and I am using ARC.
即使我试图通过跳转到买入视图来取消它,取消购买等,这在沙盒中工作正常。如果我从应用程序商店购买我的应用程序。我也似乎为大多数用户工作,因为有销售注册。
但是,我几乎每天都会收到崩溃报告,说[[SKPaymentQueue defaultQueue] addPayment:payment]已与“无效的产品标识符:( null)”崩溃。在某些情况下,似乎人们已经崩溃,立即重新启动应用程序,并试图再次购买并崩溃。
赞赏任何意见。