fingerprintjs / fingerprintjs-pro-ios

Fingerprint Identification SDK for accurate iOS device identification.
https://fingerprint.com
Other
37 stars 11 forks source link

Crash during startup on iOS 12 #27

Closed Mike-Gibson closed 1 year ago

Mike-Gibson commented 1 year ago

Hi, we've recently integrated the React Native package into our app, and encountered an issue during startup.

I believe this is the best place to raise the issue, as based on the crash report, it's in the FingerprintPro library, rather than the ReactNative wrapper, but please do let me know if it would be best to raise in the ReactNative repo instead.

We're getting an app crash during startup, with message:

Termination Description: DYLD, Library not loaded: /usr/lib/swift/libswiftCoreGraphics.dylib | Referenced from: /private/var/containers/.../Frameworks/FingerprintPro.framework/FingerprintPro | Reason: image not found

We only see this on iOS 12 - higher iOS versions seem to work as expected.

We're using RNFingerprintjsPro 1.0.4, which is pulling in FingerprintPro 2.1.5.

I'm from the ReactNative world, and my understanding of iOS side of things is fairly limited, so apologies if any of the following is irrelevant or incorrect, but I've started to investigate the issue and believe it might be to do with this XCode 14.0 issue affecting iOS 12.

Following similar steps in that issue, I ran the otool command against the library pulled in via cocapods:

otool -L '<app path>/ios/Pods/FingerprintPro/FingerprintPro.xcframework/ios-arm64/FingerprintPro.framework/FingerprintPro'

and I see

...
/usr/lib/swift/libswiftCoreGraphics.dylib (compatibility version 1.0.0, current version 120.100.0)

Based on the info in the Apple issue, it seems like this is listed as a non-weak dependency, and so is trying to load it during startup, but on iOS12 the swift runtime libraries aren't available in that location, causing the crash.

Any help/info is appreciated, Thanks

mgutski commented 1 year ago

Hi @Mike-Gibson, thank you for reporting the issue and taking your time to prepare such a detailed report. The provided description was very helpful and much appreciated.

We investigated the issue on our side and we can confirm that your analysis is correct. Having read the aforementioned thread and the responses from Apple staff members, we verified that FingerprintPro versions 2.1.4...2.1.7 were built with Xcode 14.0.1, and hence those binaries contain the problematic shared library paths. The 2.1.8 version (current latest), however, was built with Xcode 14.2 and after inspecting it with otool we can only see @rpath/libswiftCoreGraphics.dylib (compatibility version 1.0.0, current version 15.0.0), meaning that it should no longer cause the crash on iOS 12.

Our advice is to update the RNFingerprintjsPro pod in your React Native project by issuing pod update RNFingerprintjsPro command from the directory containing Podfile for iOS.

Also, we've let our React Native team know about this issue, so that they will update the React Native wrapper to reference FingerprintPro version 2.1.8 or newer.

Please kindly let us know if you still experience some issues after the library update.

Mike-Gibson commented 1 year ago

Thanks for looking into the issue, and confirming the findings.

We identified late last week that the crash occurs on iOS 12 versions 12.0 and 12.1 only, as 12.2+ includes the shared swift runtime libraries.

In our case, we decided to drop support for iOS versions < 12.2 as they are very old.

I think it makes sense to close this issue, as it does indeed seem that it's fixed in the latest FingerprintPro version. I'm afraid I won't be able to verify the fix myself though, as we have now side-stepped the issue and it isn't straight forward to test on old versions of iOS unfortunately.

Thanks for your help.