【发布时间】:2013-09-16 16:43:31
【问题描述】:
Sandbox for In App purchase testing 是否可能因为处于测试阶段而不适用于 iOS?它在iOS 6模拟器和设备上工作,但在iOS 7模拟器或设备上不工作,不断出现无法连接到iTunes。
代码:
- (void)purchaseRemoveAds
{
NSLog(@"ITEMS :%@", [IAPShare sharedHelper].iap.productIdentifiers);
[[IAPShare sharedHelper].iap requestProductsWithCompletion:^(SKProductsRequest* request,SKProductsResponse* response)
{
if(response > 0 ) {
NSLog(@"PRODUCTS: %@", [IAPShare sharedHelper].iap.products);
if ([[IAPShare sharedHelper].iap.products count] != 0) {
SKProduct* product =[[IAPShare sharedHelper].iap.products objectAtIndex:0];
[[IAPShare sharedHelper].iap buyProduct:product
onCompletion:^(SKPaymentTransaction* trans){
if(trans.error)
{
NSLog(@"Fail %@",[trans.error localizedDescription]);
}
else if(trans.transactionState == SKPaymentTransactionStatePurchased) {
[[IAPShare sharedHelper].iap provideContent:@"RemoveAds"];
NSLog(@"SUCCESS %@",response);
NSLog(@"Purchases %@",[IAPShare sharedHelper].iap.purchasedProducts);
[bannerView_ removeFromSuperview];
UIAlertView *alert = [[UIAlertView alloc]initWithTitle:@"Success!" message:[NSString stringWithFormat:@"You have successfully purchased %@", product.localizedTitle] delegate:nil cancelButtonTitle:@"OK!" otherButtonTitles: nil];
[alert show];
}
else if(trans.transactionState == SKPaymentTransactionStateFailed) {
NSLog(@"Fail");
}
}];//end of buy product
}
}
}];
}
【问题讨论】:
-
我在 iOS iPad mini 设备上测试时遇到了同样的问题...
-
如果您解决了问题,请告诉我,我也会通知您
-
最后我的解决方案是使用另一个国家的信息创建一个新的测试用户帐户,我使用的是瑞士并将其更改为美国,现在在 iOS7 的设备上完美运行。希望它也对你有用!
标签: iphone in-app-purchase ios7 itunes-store