我已经实现了一个简单的非消费的应用程序内购买机制,遵循雷温德利希教程书。
当我的应用程序启动时,我会启动一个产品信息请求:
self.productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];
_productsRequest.delegate = self;
[_productsRequest start];创建SKProductRequest。它有一个内存地址,但没有发生任何其他事情。没有调用任何委托方法:
- (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;
}我查了两次:
雷·温德利希的书没有提到除了这个我还必须做什么。
只有一次我在设备上看到了一个-didFailWithError:调用我的代表,但它再也没有出现。我的代表不会同时在设备或模拟器上被调用。我让它跑了几分钟,一点反应也没有。
iTunes连接给出了这个令人困惑的警告:
您的第一个应用程序购买必须提交一个新的应用程序版本。从“版本详细信息”页面的“应用程序采购”部分选择它们,然后单击“准备上载二进制文件”。
在能够测试应用程序购买之前,这是必需的吗?
发布于 2013-04-16 15:33:09
在iOS模拟器文档中,它是这样写的:
API限制 在iOS模拟器中,API和特性有一些限制,包括: Apple服务隐私警报,用于访问照片、联系人、日历和提醒UIBackgroundModes密钥iCloud文档同步和键值存储支持 未得到支持的框架包括: UIKit中的外部附件媒体播放器消息UI事件工具包,UIVideoEditorController类存储工具包
由于应用程序中的购买需要Store才能工作,而且Store框架不支持模拟器,所以不能在iOS模拟器中测试IAP。
更多信息:iOS模拟器文档
https://stackoverflow.com/questions/16040491
复制相似问题