问题
Possible Duplicate:
iPhone StoreKit - invalid product id's
I am getting an empty array of product identifiers from SKProductsRequest
.
I did the following steps:
Created a In App Purchase Test User account under 'Manage Users' in iTunes Connect
Created some in app purchase products under 'Manage Your In App Purchases'.
Loaded the app onto the iPhone, went to Settings → Store and logged out of the regular store
Set a breakpoint in the
(void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
callback
All the submitted Product ID's are in the response's invalidProductIdentifiers
property. When submitting the request I tried both the Product IDs created during step 2 as well as those IDs prefixed with the Bundle ID.
Thanks in advance,
Raghu
回答1:
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.
Your app needs to be built and installed locally by Xcode, not downloaded from the App Store.
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 :)
回答2:
I've been compiling a list of the reasons product identifiers come back invalid. Here's a checklist of the potential causes:
http://troybrant.net/blog/2010/01/invalid-product-ids/
回答3:
The contract for paid applications must be in effect in order to receive data about the in app purchases configured.
This worked for me. I had the exact same problem.
回答4:
I'm one the the victims here. Well, I was. Yesterday, I had the problem and revised a lot of times all the steps. Today, I reviewed all the list from troybrant.
ok my mistake, I forgot to create the proper distribution profile:fixed
uploaded a binary and rejected immediately: they say it works better than no uploading
ok, other fix: removed the 10 digits before my domain name from everywhere in Xcode (XXXXXXXXXX.com.company.app to com.company.app)
Still not working.
Check my device not to be connected with an iTunes account.
Clean build every time and remove app from device sometimes
Still not working.
- Finally, when asking for products, I used only the productID, not the whole com.company.app.productID.
AND it worked.
I think sometimes we have more than 1 mistakes, and when you correct all of them, it's hard to know what was exactly the cause of the problem.
Now I'm happy
回答5:
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.
回答6:
It seems people are getting confused on Product IDs.
You DON'T need to add the whole domain (ex. com.company.product.inappname) for InApp to work.
You MUST use the EXACT Product ID you create on iTunes Connect. In my case, I just created "Product1", used this when SKProductsRequest is called and that's it.
No more pain.
This link has plenty useful information, though is missing this small detail: http://troybrant.net/blog/2010/01/in-app-purchases-a-full-walkthrough/
回答7:
My problem was the first issue described here:
https://devforums.apple.com/thread/23344?start=0&tstart=0
"First, you need to make sure your app-id in the Portal is correct."
回答8:
Did you log out of the AppStore from Settings.app? Only when you log out, you will be prompted for logging in again.
Is In-App purchases enabled for your App ID? App ID with wild card (*) cannot be enabled for In-App Purchases. For your app, you should create a new App ID.
My two cents here: http://blog.mugunthkumar.com/coding/iphone-tutorial-%e2%80%93-in-app-purchases/
回答9:
Is your In App Purchase "Cleared for Sale"? That's the setting that I didn't check first time.
回答10:
Setting the Product Name to the same name submitted to iTunes Connect solved it for me.
回答11:
I discovered today another thing that can cause this sort of problem. Some times, for strange reasons, the app gets corrupted and all tries to buy something end in error. I solved my problem deleting the app from the device, cleaning the build on Xcode and building it again to the device.
回答12:
I found that if your application has a different title in another language then you will have this problem unless you set your iPhone language to English. It only happens in development; there doesn't seem to be a problem for production.
回答13:
I have 15 non-consummable products.
Suddenly, all 15 of them started to appear as 'invalid' in one of my devices (iPod Touch 4G), but valid in the other (iPhone 4S); very weird indeed.
I deleted/reinstalled and now it works OK.
Someone said you must launch from Xcode, but this is not necessarily true. I have many beta testers with AdHoc builds and Test User accounts, and most of the time they seem to be able to purchase OK.
That said, the whole Sandbox Environment is always shaky and has plenty of "down time". Sometimes waiting is the answer.
回答14:
Just in case someone is still having trouble getting "invalid product id"... Besides everything posted in this topic, I just installed the right debug provision profile, deleted the application from my iPhone, restarted my device and bang, got the product info. I tried this after getting the product info trough the simulator (with the latest XCode now it is possible). I was about to upload the binary and then reject it, but then I tried the above and got it. Hope it helps!
回答15:
Make sure your "Product Name" in xcode is the same as the app submitted to iTunes Connect.
回答16:
After struggling for a day or so with invalid products being returned, my solution came down to making sure the purchase item was "Developer approved for sale". Even though there was a green mark next to the item saying "cleared for sale", I still needed to upload a screenshot and select approve.
This seems like a backwards and illogical way of doing things considering I'm still testing my app and not yet ready to put it on sale.
来源:https://stackoverflow.com/questions/1471454/storekit-in-app-purchase-invalid-product-identifiers