I am trying to check in-app purchases using the post iOS 5 method of sending it to my server and checking it there. The code in my application is pretty simple:
let url = NSBundle.mainBundle().appStoreReceiptURL! let receipt = NSData(contentsOfURL: url) // Get the receipt data from the app bundle if let receipt = receipt { let requestContents: [String: NSString] = [ "receipt_data" : receipt.base64EncodedStringWithOptions(NSDataBase64EncodingOptions([])) ] // send the receipt using NSURLSessionDataTask }
The server side simply transfers the data to Apple, and then analyzes it and sends it back to the application. The problem is that the in_app field in_app unpredictably empty for a large number of clients (as you can see from the logging), but I cannot reproduce this problem on any test devices or beta testers.
What can cause this field to be empty? Following Apple's recommendation, I used SKReceiptRefreshRequest when this happens, but it doesn't seem to help.
source share