iphone - iOS 7 Beta - 应用内测试不起作用

标签 iphone in-app-purchase ios7 itunes-store

应用内购买沙箱测试是否可能不适用于 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
             }
         }
     }];
}

最佳答案

根据苹果文档,他们不支持 iOS7 模拟器中的应用内购买。您需要使用设备来测试应用内购买。我不知道为什么也无法使用设备测试应用内购买。
请引用apple doc 。其中引用 iOS 模拟器。

关于iphone - iOS 7 Beta - 应用内测试不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18833187/

相关文章:

iphone - 导航栏上的状态保存、导航 Controller 堆栈保存和手势识别器

iphone - 应用内购买恢复按钮替代放置

ios - 如何在 iOS 中对高斯模糊效果进行动画处理?

ios - 图像在iOS中自动消失

iphone - CSS 媒体查询方向更改不起作用 PhoneGap

iphone - UIView 与核心图形

iphone - 如何在 UI View 上显示两个表

开发模式下的 iOS 游戏中心

iphone - 在 iPhone 应用程序中计费

ios - [UIScreen mainScreen]iOS 7和iOS 8.bounds.size差异