Concerning SKPaymentTransaction.downloads and broken consumable purchases

This issue turned out to be a BIG issue for us. I guess it has not been an issue for anyone else, but I'm just gonna leave this here as a history document. 😁


For years, we have had several apps (10-20 of them) with IAP consumables in them working fine.


But the code of power has a will of its own.


At the launch of iOS 9 things got out of hand. On iOS 9, people were able to pay money for the consumables in our apps, but they would no longer receive the in-app goods (points, gold etc).


Panic.😮


We had to disable all in-apps in iTunes Connect for a lot of apps.


The culprit was a bit of old (and cough, my) code in paymentQueue:updatedTransactions: that among other things did a check on the .downloads property of each SKPaymentTransaction object. If the .downloads property was not nil, it would mean it had downloadable content (from iTunes servers), and thus meant it was a non-consumable, because only non-consumables can have downloads. I understand now that that is not really kosher and since we really never used downloadable content anyway, that code logic shouldn't even have existed.


But that worked for years, because the SKPaymentTransaction objects returned for consumables would have the .downloads property nil.


But then with iOS9 those objects would turn up to have a non-nil .downloads (an NSArray...), albeit with 0 elements. Fine, our code broke as described above.


That's okay, just a lot of extra hours the last few weeks. A good opportunity to dust off old code and stuff. Had to update a bunch of old 32-bit-only apps to 64 bit and so on.



Well, next year I'll personally test making IAP purchases on iOS 10 betas as soon as possible.

Concerning SKPaymentTransaction.downloads and broken consumable purchases
 
 
Q