dooboolab-community / react-native-iap

In App Purchase module for React Native!
https://react-native-iap.dooboolab.com
MIT License
2.78k stars 634 forks source link

It crashes when I launch the app on iPHone6 iOS 12, but it doesn't crash on iOS 13 #2701

Closed zyestin closed 4 months ago

zyestin commented 5 months ago

Description

After the ipa package is generated in archive. It crashed every time I opened the app, on iPhone 6 / iOS 12. However, there's no problem in debug.

It is possible that the minimum iOS version supported by swift is 13

Expected Behavior

App launched normally

Screenshots

https://github.com/dooboolab-community/react-native-iap/assets/51897571/ba8b6f5e-5c26-408b-873f-a889d5ae277e

Environment:

To Reproduce

Once the iap library is integrated into any project and archived to generate ipa. Every time open the app on an iPhone 6 or iOS 12 machine, it crashes.


[Optional] Additional Context

Xcode run with Release, then get it's crash log

* thread #1, stop reason = signal SIGABRT
  * frame #0: 0x000000010564e418 dyld`__abort_with_payload + 8
    frame #1: 0x000000010564da58 dyld`abort_with_payload_wrapper_internal + 100
    frame #2: 0x000000010564da88 dyld`abort_with_payload + 12
    frame #3: 0x00000001056108f8 dyld`dyld::halt(char const*) + 304
    frame #4: 0x00000001056136e4 dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 5396
    frame #5: 0x000000010560d044 dyld`_dyld_start + 68
zyestin commented 5 months ago

Solution I found the solution here 👉🏻 dyld: Library not loaded: /System/Library/Frameworks/SwiftUI.framework/SwiftUI

Do as below

image

Key info Why I found solution by search dyld: Library not loaded: /System/Library/Frameworks/SwiftUI.framework/SwiftUI ?
Because I suspected it was caused by the storekit2 api, I deleted the storekit2 api code in RNIapIosSk2.swift. Then I run the app using Xcode with release config. It crashed with more infomation as below.

error: '...' is not a valid command.
dyld: Library not loaded: /System/Library/Frameworks/SwiftUI.framework/SwiftUI
  Referenced from: /var/containers/Bundle/Application/B09E8A00-DF05-4E67-A775-1C6B732BFD54/HuabenApp.app/HuabenApp
  Reason: image not found
(lldb) bt
* thread #1, stop reason = signal SIGABRT
  * frame #0: 0x0000000104e7a418 dyld`__abort_with_payload + 8
    frame #1: 0x0000000104e79a58 dyld`abort_with_payload_wrapper_internal + 100
    frame #2: 0x0000000104e79a88 dyld`abort_with_payload + 12
    frame #3: 0x0000000104e3c8f8 dyld`dyld::halt(char const*) + 304
    frame #4: 0x0000000104e3f6e4 dyld`dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 5396
    frame #5: 0x0000000104e39044 dyld`_dyld_start + 68

So it is clearly about swiftUI.