question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

buySubscription returns E_UNKNOWN despite successful purchase

See original GitHub issue

Version of react-native-iap

2.2.2 (because any newer version fails on iOS due to #279)

Platforms you faced the error (IOS or Android or both?)

iOS

Expected behavior

No error should be thrown. Purchase was successful (live and in production)

Actual behavior

E_UNKNOWN error is returned from Promise Our Sentry.io error tracking reports this:

{"framesToPop":1,"code":"E_UNKNOWN","nativeStackIOS":["0   LuCoaching                          0x000000010062f6fc LuCoaching + 1996540","1   LuCoaching                          0x000000010060aa98 LuCoaching + 1845912","2   LuCoaching                          0x00000001007cad98 __cxa_throw + 438380","3   LuCoaching                          0x00000001007cc62c __cxa_throw + 444672","4   libdispatch.dylib                   0x000000019d078484 <redacted> + 16","5   libdispatch.dylib                   0x000000019d025610 <redacted> + 56","6   LuCoaching                          0x00000001007cc46c __cxa_throw + 444224","7   libdispatch.dylib                   0x000000019d0776c8 <redacted> + 24","8   libdispatch.dylib                   0x000000019d078484 <redacted> + 16","9   libdispatch.dylib                   0x000000019d0249ec <redacted> + 1068","10  CoreFoundation                      0x000000019d5ce1bc <redacted> + 12","11  CoreFoundation                      0x000000019d5c9084 <redacted> + 1964","12  CoreFoundation                      0x000000019d5c85b8 CFRunLoopRunSpecific + 436","13  GraphicsServices                    0x000000019f83c584 GSEventRunModal + 100","14  UIKitCore                           0x00000001ca444bc8 UIApplicationMain + 212","15  LuCoaching                          0x000000010044d110 LuCoaching + 20752","16  libdyld.dylib                       0x000000019d088b94 <redacted> + 4"],"userInfo":{"NSLocalizedDescription":"Verbindung mit iTunes Store nicht möglich"},"domain":"SKErrorDomain","line":26,"column":1877,"sourceURL":"/var/containers/Bundle/Application/818C8439-E250-42E8-AD57-EC4FB5FE5547/LuCoaching.app/main.jsbundle"}

Tested environment (Emulator? Real Device?)

Real Device. Live customers. Very consistenlty fails

Steps to reproduce the behavior

When testing the procedure with Sandbox users the error cannot be reproduced.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:30 (14 by maintainers)

github_iconTop GitHub Comments

5reactions
dphaenercommented, Sep 9, 2019

👍 We are experiencing this issue was well. It seems to be happening to about 10% of our users currently. We’re going to try adding this listener, but I don’t think that ultimately this is a great solution. @hyochan Is there any way we can get more detailed information in the cases where this throws, or is that a standard response from the StoreKit APIs? In every error case the message seems to be “Cannot connect to iTunes Store”, even when the purchase is successful.

4reactions
gerbuscommented, Mar 17, 2019

I’m seeing this error too. And I think I know one way to reproduce it.

Version of react-native-iap

^2.4.1

Version of react-native

https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz

Platform

iOS, when testing in TestFlight on a real device.

Observations

I noticed that when any RNIap functions were called in my app, iOS would ask me to enter a password for a previous iTunes/App Store user (which I have since logged out and replaced via iOS Settings). I read somewhere online that this is an issue that dogs iPhone users from time to time: sometimes an app is bought with one iTunes account, then the phone is switched to a new iTunes account, but the app continues to ask for the password for the old iTunes account.

I tried to delete my app (and TestFlight) and reinstall with the new App Store user, to no avail. The only way I could get rid of this behavior was to wipe the device. Once I did this, I could no longer reproduce this error.

Actual Behavior

  1. buySubscription()
  2. Select Continue when presented with iOS modal “Subscription Terms”
  3. Select OK when presented with iOS modal “Confirm Subscription”
  4. Error thrown by buySubscription():
{
   code: E_UNKNOWN, 
   column: 1565, 
   domain: NSURLErrorDomain, 
   framesToPop: 1, 
   line: 20, 
   nativeStackIOS: [...],
   sourceURL: ...,
   userInfo: {
      _kCFStreamErrorCodeKey: -4, 
      _kCFStreamErrorDomainKey: 4, 
      NSErrorFailingURLKey: None, 
      NSErrorFailingURLStringKey: https://p100-sandbox.itunes.apple.com/WebObjects/MZFinance.woa/wa/inAppBuy, 
      NSLocalizedDescription: Cannot connect to iTunes Store, 
      NSUnderlyingError: {
         code: "-1005", 
         domain: "kCFErrorDomainCFNetwork", 
         message: "underlying error", 
         nativeStackIOS: [...],
         userInfo:{"NSErrorPeerAddressKey":null,"_kCFStreamErrorCodeKey":-4,"_kCFStreamErrorDomainKey":4}
      }
   }
}

Steps to reproduce the behavior

  1. Create a test user in App Store Connect
  2. Install app from App Store (or invite test user to TestFlight and install TestFlight and then app through TestFlight)
  3. Purchase a subscription in app
  4. Let the subscription expire
  5. Logout iOS Apple ID (Settings > Apple ID, Sign Out)
  6. Login new Apple ID
  7. Purchase a subscription in app

Hope this helps someone!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Contact Us | Subscription Questions - Buysubscriptions
How to get in contact with us regarding your subscription, renewal, single issue, or have a question about subscribing on buysubscriptions.com.
Read more >
PurchaseFailureReason: Unknown - Unity Forum
1. Run game. · 2. Hit "Buy subscription" button (for 3 month with 3 free day period). · 3. Entered account password. ·...
Read more >
6 New Features in Thrive Suite – Late March 2021
Thrive Apprentice lets you build your course and restrict access to the course only to customers that have purchased it through WooCommerce.
Read more >
Frequently Asked Questions The New Yorker
You will receive your first issue between three and six weeks after purchasing a print subscription. Each issue is published one week prior...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found