gpt4 book ai didi

iphone - 如何在 iOS 模拟器或设备上测试 IAP(应用内购买)?

转载 作者:IT王子 更新时间:2023-10-29 08:05:11 32 4
gpt4 key购买 nike

我已经按照 Ray Wenderlich 教程书籍实现了一个简单的非消耗性应用内购买机制。

当我的应用启动时,我发起了一个产品信息请求:

self.productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
_productsRequest.delegate = self;
[_productsRequest start];

SKProductRequest 已创建。它有一个内存地址,但没有其他任何事情发生。没有调用任何委托(delegate)方法:

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
NSLog(@"Product info received...");
NSArray *products = response.products;
for (SKProduct *product in products) {
NSLog(@"ID: %@, title:%@, (%f)", product.productIdentifier, product.localizedTitle, product.price.floatValue);
}

self.productsRequest = nil;
}

- (void)request:(SKRequest *)request didFailWithError:(NSError *)error {
NSLog(@"Failed to load list of products");
self.productsRequest = nil;
}

我检查了两次:

  • 应用在 iTunes Connect 中完全设置。
  • 应用程序在 ITC 中的状态为“准备上传”
  • 添加了一个非消耗性 IAP。
  • IAP 产品在 ITC 中的状态为“准备提交”
  • 应用程序和 plist 中的应用程序 ID 都是 com.mycompany.myapp。检查了两次。
  • IAP 使用 com.mycompany.myapp.productname(对请求使用完全相同的 ID)。
  • 在 ITC 中创建了一个测试用户帐户。
  • 尚未向 Apple 提交任何内容。
  • 我的 Mac 可以访问互联网。
  • 控制台或屏幕上没有其他消息。

Ray Wenderlich 的书没有提到我必须做除此之外的任何事情。

只有一次我在设备上看到了一个 -didFailWithError: 调用我的委托(delegate),但它再也没有出现过。我的代表不会在设备或模拟器上都被调用。我让它运行了几分钟,一点 react 都没有。

iTunes Connect 给出了这个令人困惑的警告:

Your first In-App Purchase(s) must be submitted with a new app version. Select them from the In-App Purchases section of the Version Details page and then click Ready to Upload Binary.

在能够测试应用内购买之前需要这样做吗?

最佳答案

在当前版本的 Xcode 5.0 (5A1413) 中,应用内购买将无法在 iOS 模拟器中运行。

StoreKit (In-App purchases) will not work in the Simulator. 13962338

来源:Xcode 5.0 发行说明 > 已知问题 > iOS 模拟器 https://developer.apple.com/library/ios/releasenotes/DeveloperTools/RN-Xcode/xc5_release_notes/xc5_release_notes.html#//apple_ref/doc/uid/TP40001051-CH2-SW303

关于iphone - 如何在 iOS 模拟器或设备上测试 IAP(应用内购买)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16040491/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com