【问题标题】:iOS 7 Beta - In App testing not workingiOS 7 Beta - 应用内测试不起作用
【发布时间】: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


【解决方案1】:

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

【讨论】:

  • 是的,我找到了模拟器的文档,但无法让它与设备一起使用
  • 我的意思是我在文档中找到了说明它在 iOS 7 的模拟器中无法工作的文字
  • 我在 ios 7 设备中尝试了很多,但没有工作。它在 ios 6 中完全可以使用,但在 ios7 设备中无法使用。得到“failedTransaction ...交易错误:无法连接到iTunes Store”。你能给我正确的解决方案吗?为什么会出现这个问题?
【解决方案2】:

我今天在我的一台旧设备上遇到了类似的问题。我没有从我的产品请求中得到任何产品返回了一系列 0 产品。

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
     NSLog(@"Received products results - count:  %d...", [response.products count]); 
} 

它在其他 2 台设备上工作并返回数据,而这台 iOS5 设备是我的孩子用来玩的一台,所以我想也许有一次有人从这台设备上的商店下载了该应用程序。因此,我重新启动了设备,将我的个人帐户从设备上的商店中注销,然后删除了该应用程序,当我从 XCode 5 重新安装该应用程序时,它在沙盒中运行良好。

所以,在我看来,为了提高这些 API 的安全性,正在发生一些变化。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-21
    • 2012-08-15
    • 1970-01-01
    • 1970-01-01
    • 2015-10-17
    相关资源
    最近更新 更多