SKReceiptRefreshRequest fails with a sandboxed Apple ID

Originator:designatednerd
Number:rdar://15951298 Date Originated:1/30/14
Status:Open Resolved:No
Product:iOS SDK Product Version:7.0.4
Classification:Security Reproducible:Always
 
Summary:
When attempting to request a receipt in iOS 7 to test out receipt validation code I wrote, I discovered that I was unable to retrieve a receipt using valid sandbox credentials. It appears that sandboxed app store accounts are not being recognized properly by the server when these requests are made.

Steps to Reproduce:
1. Sign out of any normal or sandboxed App Store account
2. Restart device. 
3. Launch developer-signed application which makes an SKReceiptRefreshRequest. 
4. Attempt to sign in with sandboxed iTunes Connect account. 
5. Screenshot IMG_4042, indicating the account is not recognized as a sandboxed account. 
6. Open a different application, also developer signed, and attempt to make an In-App purchase using the same credentials. 
7. Screenshot IMG_4043, indicating the account is successfully recognized as a sandboxed account.
8. Finish sandboxed transaction in IAP app.  
8. Go back to SKReceiptRefreshRequest app, have it make another request. 
9. Sign in with same credentials. 
10. SKRequest delegate method requestDidFinish: fires regardless of error state. 
11. Observe lines similar to this in the console for the phone (attaching full console log as a .txt file):

Jan 30 16:17:22 Portable-Series-Of-Tubes storebookkeeperd[93] <Warning>: [StoreBookkeeper] [SBKTransactionController.m:457] Transaction Failed: <SBKSyncTransaction: 0x15df7be0> SYNC: anchor=0 -- Error: <SBKStoreError:0x15e1d080> "Error Code = SBKStoreErrorCodeStoreAccountSessionExpired (-1004)"
Jan 30 16:17:22 Portable-Series-Of-Tubes storebookkeeperd[93] <Warning>: [UPP-SBDJobScheduler]  Could not synchronize domain 'com.apple.upp' (<SBKStoreError:0x15e23470> "Error Code = SBKStoreErrorCodeStoreAccountSessionExpired (-1004)").  Synchronization will be re-attempted when the network connectivity, or account status has changed.

12. Bang head on desk.

Expected Results:
Same credentials that allow IAP should allow downloading of a receipt. 

Actual Results:
Receipt will not download. 

Version:
iOS 7.0.4

Notes:
I have also attached the sample SKReceiptRequest application I was working on - you can see that if you throw a breakpoint on line 94 in [Sample App] you get the non-error delegate method even if the phone is in airplane mode, so it looks like errors are not being handled properly, compounding the above issue. 

Configuration:
iPhone 5, iOS 7.0.4, my signing credentials for the developer stuff. 

Attachments:
'IMG_4042.PNG', 'IMG_4043.PNG', 'SandboxIssues.txt' and '[Sample App]' were successfully uploaded.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!