iPhone - 应用内购买问题
我已经创建了带有应用内购买功能的 iPhone 应用程序。 现在,我正处于测试阶段。
我创建了配置文件 com.satyam.testapp 在 iTunes 连接中,我创建了应用程序并上传了图像、屏幕截图、描述等。我还创建了两个用于应用内购买的 ID。一个是 com.satyam.testapp.book1,另一个是 com.satyam.testapp.book5
我创建的测试帐户也用于验证我的应用内购买。
使用 com.stayam.testapp 我创建了开发人员测试配置文件,并在我开发的应用程序中使用相同的配置文件。
我注销了 iPhone 中的 iTunes 应用商店帐户。
现在我开始在我的 iPhone 上运行我的应用程序。它说没有可以购买的物品。但它甚至没有要求我提供凭据,我必须输入测试帐户用户名和密码......
如何调试它?
这是我的代表:
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSArray *myProduct = [[NSArray alloc] initWithArray:response.products];
for(int i=0;i<[myProduct count];i++)
{
SKProduct *product = [myProduct objectAtIndex:i];
NSLog(@"Name: %@ - Price: %f",[product localizedTitle],[[product price] doubleValue]);
NSLog(@"Product identifier: %@", [product productIdentifier]);
}
for(NSString *invalidProduct in response.invalidProductIdentifiers)
NSLog(@"Problem in iTunes connect configuration for product: %@", invalidProduct);
[request autorelease];
[myProduct release];
}
I've created iPhone app with in-app purchase.
Now, I'm in testing phase.
I created provisioning profile com.satyam.testapp
In iTunes connected I created the application and uploaded the images, screen shots, desscription etc. I also created two id's for in-app purchase. One is com.satyam.testapp.book1 and the other one is com.satyam.testapp.book5
I created test account also for verifying my in-app purchases.
Using com.stayam.testapp i created developer test profile and using the same in my developed application.
I logged out the itunes app store account in my iphone.
Now i started running my application on my iphone. Its saying that no items are there to purchase. But its not even asking me for credentials where i've to enter test account username and password.....
how to debug it?
Here's my delegate:
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
NSArray *myProduct = [[NSArray alloc] initWithArray:response.products];
for(int i=0;i<[myProduct count];i++)
{
SKProduct *product = [myProduct objectAtIndex:i];
NSLog(@"Name: %@ - Price: %f",[product localizedTitle],[[product price] doubleValue]);
NSLog(@"Product identifier: %@", [product productIdentifier]);
}
for(NSString *invalidProduct in response.invalidProductIdentifiers)
NSLog(@"Problem in iTunes connect configuration for product: %@", invalidProduct);
[request autorelease];
[myProduct release];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
检查您的 SKProductsRequest 回调,这可能会显示它是由无效的产品 ID 引起的,不幸的是,在沙箱上调试这可能会很痛苦
假设它是由无效的产品 ID 引起的,请运行以下检查列表
有您是否为您的应用程序 ID 启用了应用程序内购买?
您是否检查了您的产品的“Cleared for Sale”?
您项目的 .plist Bundle ID 是否与您的应用 ID 匹配?
您是否为新的应用程序 ID 生成并安装了新的配置文件?
您是否已将项目配置为使用此新功能进行代码签名
配置文件?
您是否正在为 iPhone OS 3.0 或更高版本进行构建?
您在发出 SKProductRequest 时是否使用完整的产品 ID?
自从将产品添加到 iTunes Connect 后,您是否已经等待了几个小时?
您的银行详细信息在 iTunes Connect 上有效吗?
Check your SKProductsRequest call back, which will probably show that it is caused by an invalid product id, which unfortunately can be a pain to debug on the sandbox
Assuming it is caused by an invalid product ID run through the following check list
Have you enabled In-App Purchases for your App ID?
Have you checked Cleared for Sale for your product?
Does your project’s .plist Bundle ID match your App ID?
Have you generated and installed a new provisioning profile for the new App ID?
Have you configured your project to code sign using this new
provisioning profile?
Are you building for iPhone OS 3.0 or above?
Are you using the full product ID when when making an SKProductRequest?
Have you waited several hours since adding your product to iTunes Connect?
Are your bank details active on iTunes Connect?
尝试从您正在测试的手机中删除您的应用程序,然后“构建和调试”。
如果这不能解决您的问题,我建议您阅读以下博客文章。
http://troybrant.net/blog/2010/ 01/应用内购买完整演练/
Try deleting your app from the phone you are testing on, then "Build and Debug".
If that doesn't solve your problem, I would recommend going through the following blog post.
http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/
1- 您可以从注销现有帐户的位置使用您的测试帐户登录。
2- 对于调试,您必须等待您的产品(com.satyam.testapp.book1 和 com.satyam.testapp.book5)生效。目前,您的产品必须位于response.invalidProductIdentifiers 列表中。当您的产品有效时,系统会要求您提供测试帐户凭据。有时,产品需要一些时间才能生效,并确保您签署了付费应用程序的合同。
1- You can login with your test account from where you logged out the existing one.
2- For debuging, you have to wait for your products (com.satyam.testapp.book1 and com.satyam.testapp.book5) to become valid. Currently your products have to be in response.invalidProductIdentifiers list. You'll be asked for your test account credentials when your products will be valid. Sometimes it takes some time for products to become valid and be sure you signed contracts for paid Apps.
检查您的产品 ID “com.satyam.testapp.book1” 是否与您在 iTunes 商店中注册的产品 ID 相同,并且您选中了“清除销售”选项
checkout whether your product id "com.satyam.testapp.book1" is same as the one you registered in your iTunes store, and you checked the "clear for sale" option