问题描述
我正在尝试在我的iPhone上测试In App Purchases并遇到一个问题,我在那里请求了产品ID,最后将其作为didRecieveResponse方法中的无效产品ID返回给我。
I am trying to test In App Purchases on my iPhone and running into a problem where the product IDs I request information for end up being returned to me as invalid product IDs in the "didRecieveResponse" method.
我有:
- 创建了与此应用相关联的商店内商品。它的捆绑ID与其他所有内容相匹配。它已被清除出售并得到开发商的批准。
- 确保我的新配置文件已启用商店应用程序购买并且具有完整的应用程序名称:com.domain.appname
- 确保这是用于将应用程序签名到我的iPhone的配置文件。
- 确保com.domain.appname是用于构建配置文件的应用程序ID。
- 确保在我的plist文件中使用com.domain.appname作为软件包标识符。
- Created an in store product associated with this app. It's bundle ID matches everything else. It has been cleared for sale and approved by the developer.
- Made sure my new provisioning profile has in store app purchases enabled and it has the full app name: "com.domain.appname"
- Made sure this is the provisioning profile being used to sign the app to my iPhone.
- Made sure that "com.domain.appname" is the app ID used to build the provisioning profile.
- Made sure that "com.domain.appname" is used in my plist file as the bundle identifier.
似乎一切都已到位,但我仍然将我的产品作为无效ID返回给我。
Everything seems to be in place, however I still get my products returned to me as invalid IDs.
这是我正在使用的代码:
This is the code I am using:
- (void)requestProductData {
SKProductRequest *request = [[SKProductsRequest alloc] initWithProductIdentifiers: [NSSet setWithObject: @"com.domain.appname.productid"]];
request.delegate = self;
[request start];
}
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSArray *myProducts = response.products;
NSArray *myInvalidProducts = response.invalidProductIdentifiers;
for(int i = 1; i < myInvalidProducts.count; ++i)
{
std::cout <<"invalid product id = " << [[myInvalidProducts objectAtIndex:i] UTF8String] << std::endl;
}
for(int i = 0; i < myProducts.count; ++i)
{
SKProduct * myProduct = [myProducts objectAtIndex:i];
std::cout << "Product Info:" << std::endl;
std::cout << "\tlocalizedTitle = " << [[myProduct localizedTitle] UTF8String] << std::endl;
std::cout << "\tlocalizedDescription = " << [[myProduct localizedDescription] UTF8String] << std::endl;
std::cout << "\tproductIdentifier = " << [[myProduct productIdentifier] UTF8String] << std::endl;
std::cout << "\tprice = " << [[myProduct price] doubleValue] << std::endl;
std::cout << "\tpriceLocale = " << [myProduct priceLocale] << std::endl;
}
[request autorelease];
}
我的所有产品ID都显示在无效的打印输出中,没有它们出现在产品信息:打印输出中。
All my product IDs show up in the invalid printouts and none of them show up in the "Product Info:" printouts.
任何建议都将不胜感激......
Any suggestions would be greatly appreciated...
PS是的,这是作为Objective-c / c ++构建的。
P.S. Yes, this is built as Objective-c/c++.
推荐答案
好的,所以在做完所有我想到的和阅读之后每个论坛都在这里,这是有效的:
OK, so after doing everything I could possibly think of and reading every forum out there, here is what worked:
重做每一个。
- 从Xcode管理器中删除所有配置文件。
- 关闭Xcode。
- 创建一个新的应用程序ID。
- 使用新的App ID创建新的Provisioning配置文件。
- 使用新的App ID创建新的Distribution Provisioning配置文件。
- 创建新的iTunes iTunes中的应用程序
- 启动Xcode,安装两个新的配置文件。更新yoru包ID以匹配。另外,请确保应用程序请求的id字符串更新以反映您的软件包ID。
- 使用新的Distribution Provisioning配置文件在分发模式下构建项目。
- 上传新的二进制文件。 (保持不被拒绝)
- 设置测试应用内购买。
- 使用新的配置文件在调试模式下构建项目。
- 测试请求。
- Remove ALL your provisioning profiles from the Xcode Organizer.
- Close Xcode.
- Create a New App ID.
- Create a new Provisioning profile with the new App ID.
- Create a new Distribution Provisioning profile with the new App ID.
- Create a new App in iTunes Connect
- Start Xcode, install your two new provisioning profiles. Update yoru bundle ID to match. Also make sure your id strings that the app requests are updated to reflect your bundle id.
- Build your project in Distribution mode with the new Distribution Provisioning profile.
- Upload your new binary. (Leave it un-rejected)
- Set up your test in-app purchase.
- Build your project in Debug mode with the new Provisioning profile.
- Test request.
这是让我的商店运作所需的。我最好的猜测是苹果后端服务器有时会被搞砸,你只需要从头开始。
This is what it took to get my store working. My best guess is that the Apple back end servers get screwed up sometimes and you just need to start from scratch.
希望这对每个人都有帮助!
Hope this helps everyone!
这篇关于iPhone Store Kit返回无效的产品ID错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!