react-native-iap icon indicating copy to clipboard operation
react-native-iap copied to clipboard

EXC_BAD_ACCESS in RNIapIosSk2iOS15

Open wkirby opened this issue 1 year ago • 4 comments

Please use the Discussion board if you want to get some help. Please use issues to report bugs.

Description

App errors on iOS startup with EXC_BAD_ACCESS on productStore in RNIapIosSk2iOS15.

Expected Behavior

App starts up without exception.

Screenshots

Environment:

  • react-native-iap: 12.12.1, 12.10.8
  • react-native: 0.73.1
  • Platforms (iOS, Android, emulator, simulator, device): iOS Simulator, iPhone 15, iOS 17.2

To Reproduce Steps to reproduce the behavior:

Behavior appears on application launch.


Additional Context

Problem started happening after upgrading React Native from 0.72.4 to 0.73.1.

wkirby avatar Dec 19 '23 17:12 wkirby

Reverting my project back to an earlier commit, where we are running React Native 0.72.4 works as expected. Something appears to have changed between 0.72 and 0.73 which causes this issue.

wkirby avatar Dec 19 '23 17:12 wkirby

I went back and walked through each patch update form 0.72.4 to 0.73.1, changing nothing else about the project, and the problem does not appear. I'm currently working through updates on other packages 1 at a time to establish what causes this error to start happening.

I am doing so on 0.72.7, as 0.73.1 has some incompatibilities with other libraries in use by our app.

wkirby avatar Dec 19 '23 22:12 wkirby

Ok, on RN 0.72.7 with react-native-iap 12.10.8 everything is working, react-native-iap 12.12.1 throws the above EXC_BAD_ACCESS error

wkirby avatar Dec 19 '23 22:12 wkirby

I also get bad_access crashes a lot on ios

Exception Type: EXC_BAD_ACCESS (SIGSEGV) Exception Subtype: KERN_INVALID_ADDRESS at 0x8000000000000010 -> 0x0000000000000010 (possible pointer authentication failure) Exception Codes: 0x0000000000000001, 0x8000000000000010 VM Region Info: 0x10 is not in any region. Bytes before following region: 68719476720 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START --->
commpage (reserved) 1000000000-7000000000 [384.0G] ---/--- SM=NUL ...(unallocated) Termination Reason: SIGNAL 11 Segmentation fault: 11 Terminating Process: exc handler [21763]

Triggered by Thread: 0

Thread 0 name: Thread 0 Crashed: 0 AppName 0x0000000102f0faa4 specialized Dictionary.subscript.getter + 0 (:0) 1 AppName 0x0000000102f0faa4 RNIapIos.resolvePromises(forKey:value:) + 92 (RNIapIos.swift:90) 2 AppName 0x0000000102f1449c closure #1 in RNIapIos.purchaseProcess(:) + 164 (RNIapIos.swift:522) 3 AppName 0x0000000102f1531c specialized closure #1 in RNIapIos.getPurchaseData(:withBlock:) + 1852 (RNIapIos.swift:797) 4 AppName 0x0000000102f15df4 specialized closure #1 in RNIapIos.getPurchaseData(:withBlock:) + 24 (RNIapIos.swift:813) 5 AppName 0x0000000102f15df4 RNIapIos.purchaseProcess(:) + 24 (:0) 6 AppName 0x0000000102f15df4 specialized RNIapIos.paymentQueue(:updatedTransactions:) + 2708 7 AppName 0x0000000102f148ac @objc RNIapIos.paymentQueue(:updatedTransactions:) + 128

openpathgit avatar Apr 01 '24 19:04 openpathgit

Coming back to this, as we now need to update the IAP library for android. I've tracked the problem to this PR: https://github.com/dooboolab-community/react-native-iap/pull/2518

Version 12.10.8 works just fine, 12.11.0 is broken before the application finishes launching. I am not a Swift expert by any stretch, but I suspect that there's something about our XCode project and the storekit configuration.

@arthurgeron any chance you have insight on this?

wkirby avatar Jul 22 '24 15:07 wkirby

I have stripped out my entire storekit configuration, and removed every piece of javascript related to react-native-iap and I am still encountering this error, just by virtue of having the react-native-iap pod installed in our project.

I took some time to delve into the EXC_BAD_ACCESS error in Swift, and it appears to be something related to concurrency. My new guess, since this library appears to work for other people, is that there is something about the configuration of our application that is causing the issue, but I'm at a total loss on how to continue debugging.

wkirby avatar Jul 24 '24 16:07 wkirby