dyld[16540]: Library not loaded: @rpath/EnsecureOTP.framework/EnsecureOTP

As soon as my app running on my iPhone, it crashed.

 Referenced from: <8FCDCC59-42E7-3582-8822-ED1911A12AE6> /private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/JPay
 Reason: tried: '/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP' (mach-o file (/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP), but incompatible platform (have 'iOS-sim', need 'iOS')), '/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP' (mach-o file (/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP), but incompatible platform (have 'iOS-sim', need 'iOS')), '/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP' (mach-o file (/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP), but incompatible platform (have 'iOS-sim', need 'iOS')), '/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP' (mach-o file (/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP), but incompatible platform (have 'iOS-sim', need 'iOS')), '/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP' (mach-o file (/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP), but incompatible platform (have 'iOS-sim', need 'iOS')), '/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP' (mach-o file (/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP), but incompatible platform (have 'iOS-sim', need 'iOS')), '/private/preboot/Cryptexes/OS@rpath/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP' (mach-o file (/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP), but incompatible platform (have 'iOS-sim', need 'iOS')), '/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP' (mach-o file (/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP), but incompatible platform (have 'iOS-sim', need 'iOS')), '/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP' (mach-o file (/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP), but incompatible platform (have 'iOS-sim', need 'iOS')), '/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache), '/private/preboot/Cryptexes/OS/usr/lib/swift/EnsecureOTP.framework/EnsecureOTP' (errno=2), '/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP' (mach-o file (/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP), but incompatible platform (have 'iOS-sim', need 'iOS')), '/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP' (mach-o file (/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP), but incompatible platform (have 'iOS-sim', need 'iOS')), '/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP' (mach-o file (/private/var/containers/Bundle/Application/4422E509-1430-4F90-BA61-2CB9A8BD88C0/JPay.app/Frameworks/EnsecureOTP.framework/EnsecureOTP), but incompatible platform (have 'iOS-sim', need 'iOS')), '/System/Library/Frameworks/EnsecureOTP.framework/EnsecureOTP' (errno=2, not in dyld cache)

Depending on your iPhone/xCode version this may help you

I am having the same issue. Have you been able to find a fix for this?

Also it worths mentioning that running our app on the simulator is fine but just not on a physical device. The physical device I use is an iPhone 14 so it's not related to running the app on old version. My macOS is Monterrey 12.5 and I am using a M1 mac.

Some findings:

  1. Removing the framework and add it back in may help. But this issue is talking about Xcode 14 not being able to load dynamic libraries so it's not just about one framework but this could be multiple frameworks.
  2. I remove the values in Runpath Search Paths and it solves the issue for the frameworks from our native packages be not the third party libraries that were linked by CocoaPods.
  3. I have tried setting Runpath Search Paths to be like below but this doesn't help.
$(inherited)
@executable_path/Frameworks
@loader_path/Frameworks

I have been searching over the Internet for this but most of the posts are talking about the libswiftCoreGraphics and these two are not the same. libswiftCoreGraphics are swift library so setting the Other Linker Flag to weak link can help but our issues are not with any swift library.

To sum up, I believe it's some config issues with the Runpath Search Paths but not sure how to set it.

@Ptit-Xav, I don't believe that these two are the same

dyld[16540]: Library not loaded: @rpath/EnsecureOTP.framework/EnsecureOTP
 
 
Q