Monday, April 11, 2011

Possible cause for empty response.products passed to productsRequest:didReceiveResponse: when using Apple's StoreKit

Some time has passed since I first blogged about my first experience with Apple's in app purchase mechanism for iOS, and the pitfalls I encountered.

Since then, I published several apps in the App Store, and now, when the time to update some of them has come, I came across a new issue. When testing the updates to my apps, I'm getting an empty response.products passed to - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response.

It's like Apple's servers doen't recognize my product ids. The same ids that are functioning properly on a live version of the app. WTF ?

Looking more closely on the issue reveals that I've been trying to install my update, built using a dev certificate, on top of the existent version of the app available in the app store, which of course was built with a different certificate. In any case, the ids placed in the request sent to Apple's servers are clearly legitimate. In fact, if I uninstall the app from my device and re-install the app update from scratch everything works fine. This can be used as a workaround for the issue.

This is more likely a bug on Apple's side, although one could argue that the issue is with my code, that perhaps botches the update process. I'll need to run some more tests to rule this out, but in the meantime, if you're having such issues you can try the workaround described above.

3 comments:

Guy Umbright said...

Thanks. This is exactly the problem I was having and deleting the release app first worked like a charm.

cri1682 said...

Hi i have the same problem. I have an app on the app store with some "ready to sell" in-app. Everything it's ok with this versione of the app...Now i'm ready to publish an update to the new version...But when i build my update on the actuale version of the app, productsRequest return all invalid ids... Naturally if i build and run directly the update in my device, all works perfectly... In my test i use the same develop provisioning profile (the same for version 1.0 and version 1.1) and the same products identifiers.But the result is the same, an empty store. So i think that SKProductsRequest sends to apple the bundle id and check if it's already approved and online. Maybe in this way my developing provisioning profile mismatch the distribution profile of the App Store version of my app. Anyway what i wanna ask you is: Have you published the update of your app? Releasing the app with a distribution profile,solve the problem?

Unknown said...

@ cri1682 yes, I published my update, and it worked fine. However, if I were you, I would still test it in the dev environment, to catch any breaks. Like I said in my post, if I installed my update from scratch, that is, not on top of a previously installed released version, the issue goes away.

As of why this happens, we can only guess, which is even more complicated by the fact that released versions talk to the live server, while dev versions talk to the sandbox.