和许多教程一样(如:http://www.raywenderlich.com/2797/introduction-to-in-app-purchases).我在iTunesConnect中创建了新的应用程序,上传了二进制文件并拒绝了它.之后,我在应用购买产品中添加了一些.在下一步中,我将Storekit添加到我的Xcode项目中,之后我在UIViewController中编写了这段代码:
- (void)buyPressed { SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithObjects: @"com.mycompany.appliaction_name.levelpack",nil]]; request.delegate = self; [request start]; NSLog(@"request started"); } - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response { NSArray *products = response.products; for (int i=0; i<[products count]; i++) { SKProduct *proUpgradeProduct = [products objectAtIndex:i]; if (proUpgradeProduct) { NSLog(@"Valid product id: %@",proUpgradeProduct.price); NSLog(@"Product title: %@",proUpgradeProduct.localizedTitle); NSLog(@"Product description: %@",proUpgradeProduct.localizedDescription); NSLog(@"Product price: %@",proUpgradeProduct.price); NSLog(@"Product id: %@",proUpgradeProduct.productIdentifier); } } for (NSString *invalidProductId in response.invalidProductIdentifiers) { NSLog(@"Invalid product id: %@",invalidProductId); UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Apple connection error!" message:nil delegate:self cancelButtonTitle:@"CLOSE" otherButtonTitles:nil]; [myAlertView show]; [myAlertView release]; } }
我仍然收到所有我的应用程序产品都有无效产品ID的信息.今天我发现了这个:http://developer.apple.com/library/ios/#technotes/tn2259/_index.html
还有一件重要的事情:
“重要提示:在应用程序准备好进行App Review批准之前,请勿将开发二进制文件上传到iTunes Connect.如果二进制文件存在于iTunes Connect中并且功能不完整,App Review将检查二进制文件并可能拒绝开发二进制文件.如果您或App Review在iTunes Connect中拒绝您最近的二进制文件,则在应用程序购买中测试将失败.此情况下的解决方法是上传没有应用内购买功能的二进制文件,这些功能可以获得App Review批准.一旦二进制文件获得批准,恢复使用In App Purchase功能测试二进制文件.“
所以我必须再次在iTunes中创建新的应用程序,或者我应该在没有应用程序购买的情况下构建和提交我的应用程序,当应用程序出现在iTunes中时,在应用程序购买中开发新版本?
谢谢你的回答!
解决方法
invalidProductIdentifiers (An array of product identifier strings that were not recognized by the Apple App Store. (read-only))
因此,请确保您没有使用被拒绝的相同产品标识符
Run Xcode after disconnecting your device,and run a Build->Clean All Targets.
Run Xcode->Empty Caches,and then quit and re-launch Xcode.
After Xcode is re-launched and your device has restarted,re-connect it to you machine.
Create an entirely new iTunes Test Account on the iTunesConnect portal.
Build and Run your application from XCode to your device using a Development profile and then attempt to purchase the product using the new iTunes Test Account.
如果您提交申请并且二进制文件因任何原因被拒绝,应用程序内购买可能会停止在沙箱中正常运行. Apple指出,恢复此功能的唯一方法是重新提交没有IAP功能的应用程序二进制文件,并首先获得批准(但不一定是已发布).
看看我的另一个相关[ANSWER]