transactionReceipt for in-app purchase is deprecated in iOS 7. What can I replace it with? transactionReceipt for in-app purchase is deprecated in iOS 7. What can I replace it with? objective-c objective-c

transactionReceipt for in-app purchase is deprecated in iOS 7. What can I replace it with?


You can get the receipt as the contents of the mainBundle's appStoreReceiptURL. You can find references: developer.apple.com

This is untested code, but off the top of my head, I'd say something along the lines of:

[NSData dataWithContentsOfURL:[[NSBundle mainBundle] appStoreReceiptURL]]

should get you the same result that transactionReceipt used to return.


In case anyone maybe also confused about this problem (Maybe You also read an a little outdated tutorial like me...)

Please checkout WWDC 2014 Session 305 Preventing Unauthorized Purchases with Receipts. It covers both iOS & OS X, clear and comprehensive.