iPhone StoreKit - 无效的产品 ID

发布于 2024-07-26 05:03:13 字数 800 浏览 12 评论 0原文

我正在尝试在沙盒环境中测试应用内购买。

为了测试代码,我执行了以下操作:

  1. 在 iTunes Connect 中的“管理用户”下创建了应用内购买测试用户帐户

  2. 在“管理您的应用内购买”下创建了一些应用内购买产品。 我对产品 ID 使用了数字值和字母数字值。

  3. 将应用程序加载到 iPhone 上,转到“设置”->“商店”,然后退出常规商店并登录到步骤 1 中创建的测试帐户

  4. 在 (void)productsRequest:(SKProductsRequest *)请求 didReceiveResponse:(SKProductsResponse *)响应 回调

所有提交的产品 ID 都在 response.invalidProductIdentifiers 属性中。 提交请求时,我首先尝试了在步骤 2 中创建的确切产品 ID。我还尝试在它们前面添加捆绑包 ID:

NSString *id2 = @"com.super.duper.8";
NSSet *productList = [NSSet setWithObjects:id2, @"8", nil];

SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers:productList];

我是否遗漏了一些明显的内容? 任何帮助表示赞赏。

阿希姆

I'm trying to test In App Purchase within the sandbox environment.

In order to test the code I did the following:

  1. Created an In App Purchase Test User account under 'Manage Users' in iTunes Connect

  2. Created some in app purchase products under 'Manage Your In App Purchases'. I used numeric values and alpha-numeric values for the Product IDs.

  3. Loaded the app onto the iPhone, went to Settings->Store and logged out of the regular store and into the test account created in step 1

  4. Set a breakpoint in the
    (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
    callback

All the submitted Product ID's are in the response.invalidProductIdentifiers property.
When submitting the request I first tried the exact Product IDs created during step 2. I also tried prefixing them with the Bundle ID:

NSString *id2 = @"com.super.duper.8";
NSSet *productList = [NSSet setWithObjects:id2, @"8", nil];

SKProductsRequest *request= [[SKProductsRequest alloc] initWithProductIdentifiers:productList];

Am I missing something obvious?
Any help is appreciated.

Achim

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(22

凑诗 2024-08-02 05:03:13

如果您仍然收到无效的产品 ID,我一直在积累所有各种原因的清单:

http://troybrant.net/blog/2010/01/invalid-product-ids/

If you are still getting invalid product ids, I've been accumulating a checklist of all of the various causes:

http://troybrant.net/blog/2010/01/invalid-product-ids/

还不是爱你 2024-08-02 05:03:13

我花了两天的时间来处理我的所有 productsRequest(针对 AppID)最终出现在response.invalidProductIdentifiers 列表中,而不是在response.products 列表中。 苹果在处理他们的 storekit 方面确实做了 F 级的工作。 它令人困惑、交织和复杂。

我终于解决了。 正如论坛中的少数人所指出的那样,我学到了一个非常重要的教训:您在 itunesconnect.apple.com 上输入的内容可能需要几个小时才能生效。

xcode 中有两部分:应用程序名称和 AppID以及您在 itunesconnection 中输入的内容,它们必须完全匹配(区分大小写)。 如果您注册或修改了您的应用程序内AppleID(我还按照一些人的建议完成了所有合同和银行信息,如果不完成这部分,购买操作将无法进行),您不妨先去睡觉,然后再次测试因为就我而言,确实需要几个小时才能生效。 在我 9 岁的孩子拖着我讲睡前故事之前,我非常沮丧地与这个问题作斗争,然后惊讶地发现当我醒来时这个问题消失了。

我在 http://www.iphonedevsdk.com/forum/iphone-sdk-development/21035-problems-creating-test-user-app-purchase.html 非常有帮助。 在解决这个问题之前,我在 Eddy 的检查清单中做了所有我能做的事情,但仍然得到了零个产品,我担心的一个问题是,如果不上传二进制代码来完成 itunesconnect 中的应用程序注册,是否可以(不需要像中所教导的那样上线) http://blog.mugunthkumar.com /coding/iphone-tutorial-%E2%80%93-in-app-purchases/)。 确实是可以的。 确保“已批准出售”已选中并且图标为绿色(填写表格后您需要执行额外的步骤来批准)。 另一个担心是我是否可以在调试模式下使用开发人员临时(不是分发临时),它也确实可以。 我希望这可以帮助你们中的一些人。 祝你好运并有信心。 它最终会起作用的。

I spent two days struggling with all my productsRequest (for AppID) ended up in response.invalidProductIdentifiers list, instead of in response.products list. Apple definitely did an F grade job in dealing with their storekit. It is confusing, intertwined and complex.

I did finally resolved it. One very important lesson I learned as indicated by few in the forums: It may take many hours for what you entered on the itunesconnect.apple.com to take affect.

There are two parts: application name and AppID in your xcode and what you entered in itunesconnection, they have to match exactly (case sensitive). If you registered or modified your in-App AppleID (I also completed all my contracts and bank information as suggested by some that the purchase actions won't work without getting this part done), you may as well go to bed before testing it again because it really takes hours in my case to take affect. I was so frustrated battling with this issue before my 9 year old dragged me for bed time story then surprised to find the issue disappeared when I woke up.

I found the suggestions by Eddy71 in http://www.iphonedevsdk.com/forum/iphone-sdk-development/21035-problems-creating-test-user-app-purchase.html really helpful. Before resolving it I did everything I possibly could do in Eddy's check list and still got zero products, one of my fears was that whether without uploading the binary code to complete the application registration in itunesconnect was ok (no need to go live as taught in http://blog.mugunthkumar.com/coding/iphone-tutorial-%E2%80%93-in-app-purchases/). It is indeed ok. Make sure the "cleared for sale" is check and in the icon is green (you need an extra step to approve it after filling out the form). The other fear was that whether I can use developer provisional (not distribution provisional) in debug mode, it is also indeed ok. I hope this may help some of you. Good luck and have faith. It will work eventually.

半暖夏伤 2024-08-02 05:03:13

我们的问题是 Apple 常见问题解答中的最后一个要点,“为什么我的产品标识符返回到 invalidProductIdentifiers 数组中?”:

  • 您没有完成所有财务要求(请参阅“合同” 、税务和银行信息”部分)。
  • 您没有使用明确的应用程序 ID。
  • 您没有使用与您的显式应用程序 ID 关联的配置文件。
  • 您没有在代码中使用正确的产品标识符。 有关产品标识符的更多信息,请参阅技术问答、QA1329、“应用内购买产品标识符”。
  • 您未清除在 iTunes Connect 中销售的应用内购买产品。
  • 您可能修改了您的产品,但这些更改尚未适用于所有 App Store 服务器。
  • 如果您或 App Review 在 iTunes Connect 中拒绝了您最新的二进制文件。

我通过点击 iTunes Connect 中的“准备上传二进制文件”将最新版本(已被拒绝)更改为“等待上传”大约10分钟后问题得到解决。

Our issue was the last bullet point from Apple's FAQ, "Why are my product identifiers being returned in the invalidProductIdentifiers array?":

  • You did not complete all the financial requirements (see the "Contracts, Tax, and Banking Information" section of this document).
  • You did not use an explicit App ID.
  • You did not use the Provisioning Profile associated with your explicit App ID.
  • You did not use the correct product identifier in your code. See Technical Q&A, QA1329, 'In App Purchase Product Identifiers' for more information about product identifiers.
  • You did not clear your In App Purchase products for sale in iTunes Connect.
  • You might have modified your products, but these changes are not yet available to all the App Store servers.
  • If you or App Review rejected your most recent binary in iTunes Connect.

I changed the most recent version (which had been rejected) to "Waiting for Upload" by clicking "Ready to Upload Binary" in iTunes Connect and the problem was resolved after about 10 minutes.

澜川若宁 2024-08-02 05:03:13

手机越狱了,只要在Cydia中卸载appSync就可以了

it's OK that the phone is jailbroken, you just have to uninstall appSync in Cydia, then it works

影子的影子 2024-08-02 05:03:13

苹果公司有一份很棒的文件,但不为人所知,最后涵盖了这一点。 它还消除了一些关于没有帮助的事情的神话(例如提交二进制文件)。

技术说明 2259“向 iOS 和 Mac 应用程序添加应用内购买”< /a>

Apple has a fantastic document which is not well known that covers this at the end. It also dispels some myths about things that don't help (eg. submitting a binary).

Technote 2259 "Adding In-App Purchase to your iOS and Mac Applications"

只想待在家 2024-08-02 05:03:13

我们最终创建了一个新的配置文件,某处有一行(不记得在哪里,不是在应用程序内购买的文档中)指出您必须在配置文件中启用应用程序内购买。 我们无法使用现有的配置文件来做到这一点,因此我们创建了一个新的配置文件,然后我们就可以启用它。

We ended up creating a new provisioning profile, there was a line somewhere (can't recall where, not in the docs for in app purchase) that stated that you have to enable in app purchase in the provisioning profile. We couldn't do that with our existing profile, so we created a new one and then we could enable it.

无声情话 2024-08-02 05:03:13

尝试重置iPhone设置并从iPhone中删除该应用程序并直接使用请求产品ID而不使用Bundle ID

Try resetting the iphone settings and delete the app from iphone and use the request product id directly without the Bundle ID

初懵 2024-08-02 05:03:13

对于遇到这些问题的其他人,我强烈建议阅读此帖子 在苹果论坛上。

For anyone else that has these issues, I highly recommend reading this thread on the Apple Forum.

傻比既视感 2024-08-02 05:03:13

我尝试了苹果论坛和此处建议的所有内容,但仍然无法正常工作。 找到了解决方案 - 您的应用程序需要通过 Xcode 传输才能启用沙箱。

很明显,对吧? 那么,如果您正在对现有应用程序进行更新,设备仍会将其视为 App Store 安装的应用程序。

因此,请从您的设备中删除该应用程序。 然后使用 Build & 将应用程序重新安装到设备上。 将设备连接到 Mac 来运行。 现在应该可以工作了:)

I tried everything suggested in the Apple forums and here, and still couldn't get it to work. Found the solution - your app needs to be transferred by Xcode for the sandbox to be enabled.

Obvious, right? Well, if you are working with an update to an existing application, the device will still treat it as an App Store-installed app.

So delete the app from your device. Then install the app back onto the device using Build & Run with your device tethered to your Mac. It should work now :)

怕倦 2024-08-02 05:03:13

就我而言,我没有填写银行信息、税务信息和联系信息。完成此操作后,我可以获得我的产品ID,希望这会对某人有所帮助。

In my case, I didn't complete the bank info, tax info, and contact info.Once I finish this, I can get my productID, hope this will help someone.

如果没有你 2024-08-02 05:03:13

这就是您出错的地方,您需要在代码中使用以下内容:

NSSet *productList = [NSSet setWithObjects:product id]

您可以从 iTunes connect 获取此产品 id。

您需要确保您已创建测试用户,并已退出原始 iTunes 帐户。 请参阅不要使用测试用户帐户登录,无论苹果文档如何说明,只需在出现弹出窗口时使用它即可。

This is where you are going wrong, you need this in your code:

NSSet *productList = [NSSet setWithObjects:product id]

You can get this product id from iTunes connect.

And you need to make sure that you have created a test user, and have signed out of your original iTunes account. Please see do not sign in with test user account, regardless of what apple documentation says, just use it when a pop up appears.

吻风 2024-08-02 05:03:13

那@“8”是做什么用的? 您的产品名为 com.super.duper.8 对吗?

http://blog.mugunthkumar。 com/coding/iphone-tutorial-%e2%80%93-in-app-purchases/

What's that @"8" for? your product is named as com.super.duper.8 right?

http://blog.mugunthkumar.com/coding/iphone-tutorial-%e2%80%93-in-app-purchases/

甜点 2024-08-02 05:03:13

我遇到的另一个问题是我必须转到“窗口”>“ 在 Xcode 中管理并删除我的应用程序和配置文件,然后重新添加我的开发配置文件。 作为额外措施,我重新启动了设备和 xcode。

Another issue I had was that I had to go to Window > Organizer in Xcode and delete my app and the provisioning profile(s) and re-add my development provisioning profile. I restarted the device and xcode as an extra measure.

醉酒的小男人 2024-08-02 05:03:13

我已经尝试了互联网上可用的所有解决方案,但没有任何效果,绝对没有。 我的问题:我的设备已越狱并且装有 Cydia。 我将设备恢复为出厂默认设置(未越狱),它第一次工作并且返回产品 ID 没有问题。

I have tried every solution that available on the internet, and nothing worked, absolutely nothing. My problem: My device was jailbroken and had Cydia on it. I restored the device to factory defaults (Not jailbroken) and it worked the first time and returned the product ID no problem.

不气馁 2024-08-02 05:03:13

对我来说,问题是我在设置应用内购买时选择了“打开内容托管”。 所以我不得不把它关掉,问题就解决了。

For me the problem was that I had chosen "Turn on Content Hosting" when set up the In-App purchase. So I had to turn it off and the problem was resolved.

み零 2024-08-02 05:03:13

商店需要一些时间才能将产品提供给所有服务器(请参阅文档)。 因此,在 iTunes Connect 中创建产品和在设备上测试时看到该产品 ID 为有效产品之间可能会遇到延迟。 对我来说,我的产品大约花了 12 个小时才出现。

It takes the store some time to make the products available to all server (see documentation). So you might experience a delay between creating a product in iTunes Connect and seeing that product id as a valid one when testing on device. For me it took around 12 hours till my products showed up.

心房敞 2024-08-02 05:03:13

其他人注意:不要使用 NSMutableSet 作为产品 ID。 它必须是一个 NSSet!

A note for others: do not use an NSMutableSet for the product IDs. It has to be an NSSet!

十秒萌定你 2024-08-02 05:03:13

如果您想保留应用数据,但想尝试删除应用来解决此问题,请先同步您的设备。 然后删除您的应用程序并从 Xcode 重新安装——这解决了我的问题。 一旦它开始工作,您就可以从备份中恢复您的设备——这只需要几分钟,并且产品请求在恢复后仍然有效。

If you want to keep your app data but you want to try deleting your app to fix this issue, sync your device first. Then delete your app and reinstall from Xcode -- this fixed the issue for me. Once it's working, you can restore your device from its backup -- this only takes a few minutes and the product requests still work after the restore.

前事休说 2024-08-02 05:03:13

不太清楚为什么,但是当我将请求的产品 ID 从“com.mycompany.myapp.product”更改为“product”时,它开始工作。 也许是因为我在 iTunes Connect 中配置产品的方式。

尝试一下,可能对你们中的一些人有用......

Not exactly sure why, but when I changed the request's product ID from 'com.mycompany.myapp.product' to 'product' it started working. Maybe it's because of how I have the product configured in iTunes Connect.

Give it a try, might work for some of you...

我的痛♀有谁懂 2024-08-02 05:03:13

用。。。来代替

NSSet *productList = [NSSet setWithObjects:id2, @"8", nil];

NSSet *productList = [NSSet setWithObjects:@"8", nil];

replace:

NSSet *productList = [NSSet setWithObjects:id2, @"8", nil];

with:

NSSet *productList = [NSSet setWithObjects:@"8", nil];
我爱人 2024-08-02 05:03:13

另一个问题可能是。 如果您的 xCode 项目的名称不是英文,或者其中包含其他字符,则捆绑包 ID 将在您的应用程序名称应为的位置出现“-----”。 我认为这只是包 ID 的约定,在 xCode 中包含它。 事实证明,这是我的问题,所以用英语命名你的 xCode 项目)我知道大多数情况并非如此,但无论如何)

Another problem that might be. If the name of your xCode project is not written of English, or has other characters in it, bundle ID will have "------" where the name of your app should be. I thought it is just a convention for bundle id, to have this in xCode. Turns out, this was my problem, so name your xCode project on English ) I know this is not the case for the most, but anyway)

放低过去 2024-08-02 05:03:13

我尝试了每个人都在谈论的一切。 我最终先创建了一个访客帐户,看看是否可以找到产品 ID.... 是的。 然后我开始退出活动监视器中的所有内容并发现了问题。 我不得不退出下面的“商店”进程。 突然之间,我不再获取无效的产品 ID。 希望能帮助那里的人。

退出这些如果您收到无效产品 ID null 错误

I tried everything everyone is talking about. I ended up making a guest account first to see if the product ID could be found.... It was. So then I started quitting everything in activity monitor and found the problem. I had to quit the "store" processes below. All of a sudden I stopped getting the invalid product ID. Hope that helps someone out there.

Quit these if you're getting the invalid product id null error

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文