Solved

React Native - Purchase.restoreTransactions failed in iOS version 15

  • 6 October 2021
  • 5 replies
  • 397 views

Badge

I’m using the RevenueCat SDK version 4.3.1 for React Native. It’s working well with iOS version 14 and below in Sandbox mode, but if I install the app from TestFlight into a device that runs iOS version 15 then the restoreTransactions will be failed (Note that the restoreTransactions still works well if I install the app from XCode or the ipa file). I tried to create a new sandbox account and reset the device, but it doesn’t help.

 {"framesToPop":1,"code":"9","domain":"RCPurchasesErrorDomain","userInfo":{"readable_error_code":"MISSING_RECEIPT_FILE","NSLocalizedDescription":"The receipt is missing.","readableErrorCode":"MISSING_RECEIPT_FILE"},"nativeStackIOS":["0   Rosy                                0x0000000100921cac _ZN8facebook5react11JSIExecutor21defaultTimeoutInvokerERKNSt3__18functionIFvvEEENS3_IFNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEvEEE + 396532","1   Rosy                                0x00000001008f7030 _ZN8facebook5react11JSIExecutor21defaultTimeoutInvokerERKNSt3__18functionIFvvEEENS3_IFNS2_12basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEvEEE + 221304","2   Rosy                                0x000000010088f76c _ZN5folly6detail8function14FunctionTraitsIKFbRKNS_7dynamicES5_EE10uninitCallERNS1_4DataES5_S5_ + 1113756","3   Rosy                                0x0000000100852bbc _ZN5folly6detail8function14FunctionTraitsIKFbRKNS_7dynamicES5_EE10uninitCallERNS1_4DataES5_S5_ + 865004","4   Rosy                                0x0000000100824b6c _ZN5folly6detail8function14FunctionTraitsIKFbRKNS_7dynamicES5_EE10uninitCallERNS1_4DataES5_S5_ + 676508","5   Rosy                                0x0000000100845418 _ZN5folly6detail8function14FunctionTraitsIKFbRKNS_7dynamicES5_EE10uninitCallERNS1_4DataES5_S5_ + 809800","6   Rosy                                0x0000000100844dd0 _ZN5folly6detail8function14FunctionTraitsIKFbRKNS_7dynamicES5_EE10uninitCallERNS1_4DataES5_S5_ + 808192","7   Rosy                                0x0000000100824904 _ZN5folly6detail8function14FunctionTraitsIKFbRKNS_7dynamicES5_EE10uninitCallERNS1_4DataES5_S5_ + 675892","8   Rosy                                0x00000001008291b8 _ZN5folly6detail8function14FunctionTraitsIKFbRKNS_7dynamicES5_EE10uninitCallERNS1_4DataES5_S5_ + 694504","9   Rosy                                0x000000010082c6d8 _ZN5folly6detail8function14FunctionTraitsIKFbRKNS_7dynamicES5_EE10uninitCallERNS1_4DataES5_S5_ + 708104","10  StoreKit                            0x00000001a7582d04 E6970DDA-D23E-3AFA-8765-C5829B22BFDE + 171268","11  StoreKit                            0x00000001a7582990 E6970DDA-D23E-3AFA-8765-C5829B22BFDE + 170384","12  libdispatch.dylib                   0x00000001833f3c04 959CD6E4-0CE7-3022-B73C-8B36F79F4745 + 7172","13  libdispatch.dylib                   0x00000001833f5950 959CD6E4-0CE7-3022-B73C-8B36F79F4745 + 14672","14  libdispatch.dylib                   0x0000000183403d30 _dispatch_main_queue_callback_4CF + 940","15  CoreFoundation                      0x000000018373bce4 6174789A-E88C-3F5C-BA39-DE2E9EDC0750 + 335076","16  CoreFoundation                      0x00000001836f5ebc 6174789A-E88C-3F5C-BA39-DE2E9EDC0750 + 48828","17  CoreFoundation                      0x00000001837093c8 CFRunLoopRunSpecific + 600","18  GraphicsServices                    0x000000019ef1a38c GSEventRunModal + 164","19  UIKitCore                           0x00000001860af0bc 0E2D8679-D5F1-3C03-9010-7F6CE3662789 + 5353660","20  UIKitCore                           0x0000000185e2cbe8 UIApplicationMain + 2124","21  Rosy                                0x00000001006cc084 Rosy + 32900","22  dyld                                0x0000000101179a24 start + 520"]}

 

icon

Best answer by ryan 6 October 2021, 17:51

View original

5 replies

Userlevel 5
Badge +9

Hey @Wrethink thanks for the logs! It looks like you’re getting a `MISSING_RECEIPT_FILE` error. In sandbox (including Testflight) a receipt is not generated until a purchase is made, which means you aren’t able to restore purchases until you have made a purchase. 

In Testflight, the app is running with your device Apple ID account not your sandbox account. If you make a purchase first in Testflight, then you should be able to restore.

Badge

@ryan I see the different behavior of purchase between iOS 14 and iOS 15:

  • iOS 14: The app recognizes the Sandbox account in Setting/App Store/Sandbox
    • Call restoreTransactions / purchaseProduct: The Apple ID login modal will be shown if there isn’t a Sandbox account in Setting/AppStore
  • iOS 15: The app doesn’t recognize the Sandbox account in Setting/App Store/Sandbox
    • Call restoreTransactions: The Apple ID login modal doesn’t show and the RevenueCat SDK throws an exception MISSING_RECEIPT_FILE immediately
    • Call purchaseProduct: The Apple ID login modal always be shown, even there is already a Sandbox account in Setting/App Store/Sandbox 
Userlevel 5
Badge +9

You can try creating a new sandbox test user and signing in with that. Maybe the sandbox account is corrupted? Note that TestFlight does not use the sandbox account - so if it’s an issue in TestFlight it’s most likely not related to the sandbox account. 

Badge

I tried with many new sandbox accounts, but it didn’t work. This different behavior only happens when I install the app from TestFlight.

What’s do you mean “ TestFlight does not use the sandbox account”? I can download my app from TestFlight and use the sandbox account from Setting/App Store/Sandbox Account with device run iOS 14, but not for iOS 15.

 

Userlevel 5
Badge +9

What’s do you mean “ TestFlight does not use the sandbox account”? I can download my app from TestFlight and use the sandbox account from Setting/App Store/Sandbox Account with device run iOS 14, but not for iOS 15.

Testflight is designed for distribution to test customers, those test customers don’t have sandbox accounts and use their real Apple ID to log in. Maybe the login prompt succeeds with sandbox credentials but there’s some other underlying issue - in Testflight I’m pretty sure you need to use a real Apple ID.

Reply