1

When trying to run my app in the Xcode simulator it runs successfully, but when I try to run my app on my iPhone this is the error message I keep getting:

dyld: Library not loaded: @rpath/AvailableHapticFeedback.framework/AvailableHapticFeedback
  Referenced from: /private/var/containers/Bundle/Application/CAFEEAC3-7D4A-4188-926A-5E90DEF449BC/MyApp.app/MyApp
  Reason: no suitable image found.  

Did find:
    /private/var/containers/Bundle/Application/CAFEEAC3-7D4A-4188-926A-5E90DEF449BC/MyApp.app/Frameworks/AvailableHapticFeedback.framework/AvailableHapticFeedback: 
code signature invalid for '/private/var/containers/Bundle/Application/CAFEEAC3-7D4A-4188-926A-5E90DEF449BC/MyApp.app/Frameworks/AvailableHapticFeedback.framework/AvailableHapticFeedback'

    /private/var/containers/Bundle/Application/CAFEEAC3-7D4A-4188-926A-5E90DEF449BC/MyApp.app/Frameworks/AvailableHapticFeedback.framework/AvailableHapticFeedback: 
code signature invalid for '/private/var/containers/Bundle/Application/CAFEEAC3-7D4A-4188-926A-5E90DEF449BC/MyApp.app/Frameworks/AvailableHapticFeedback.framework/AvailableHapticFeedback'

    /private/var/containers/Bundle/Application/CAFEEAC3-7D4A-4188-926A-5E90DEF449BC/MyApp.app/Frameworks/AvailableHapticFeedback.framework/AvailableHapticFeedback: 
stat() failed with errno=1
    /private/var/containers/Bundle/Application/CAFEEAC3-7D4A-4188-926A-5E90DEF449BC/MyApp.app/Frameworks/AvailableHapticFeedback.framework/AvailableHapticFeedback: 
code signature invalid for '/private/var/containers/Bundle/Application/CAFEEAC3-7D4A-4188-926A-5E90DEF449BC/MyApp.app/Frameworks/AvailableHapticFeedback.framework/AvailableHapticFeedback'

    /private/var/containers/Bundle/Application/CAFEEAC3-7D4A-4188-926A-5E90DEF449BC/MyApp.app/Frameworks/AvailableHapticFeedback.framework/AvailableHapticFeedback: stat() failed with errno=1
    /private/var/containers/Bundle/Application/CAFEEAC3-7D4A-4188-926A-5E90DEF449BC/MyApp.app/Frameworks/AvailableHapticFeedback.framework/AvailableHapticFeedback: 
code signature invalid for '/private/var/containers/Bundle/Application/CAFEEAC3-7D4A-4188-926A-5E90DEF449BC/MyApp.app/Frameworks/AvailableHapticFeedback.framework/AvailableHapticFeedback'

    /private/var/containers/Bundle/Application/CAFEEAC3-7D4A-4188-926A-5E90DEF449BC/MyApp.app/Frameworks/AvailableHapticFeedback.framework/AvailableHapticFeedback: stat() failed with errno=1

I'm currently using Xcode Version 11.3.1 (11C504) I've tried:

  • Clean Build Folder

  • Restarting Xcode

  • Restarting the MacBook

  • Restarting the iPhone
  • Trying it on an iMac
  • Updating the MacBooks operating system

  • Xcode is up to date.

  • Checked Runpath Search Paths: $inherited @executable_path/Frameworks @loader_path/Frameworks
  • Build Options - Always Embed Swift Standard Libraries = YES

  • Deleting the Derived Data folder and trying again.

  • Clearing out my Keychain
  • My Apple Development certificate is set to 'Use System Defaults'
  • I've downloaded the AppleWWDRCA.cer and installed it.

  • I've tried updating the pod file and installing those again.

I've also run the following commands in Terminal:

rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"

rm -rf ~/Library/Developer/Xcode/DerivedData

rm -rf ~/Library/Caches/com.apple.dt.Xcode

  • In the Target > General Build Settings > Frameworks, Libraries, and
    Embedded Content I have Pods_MyApp.framework, under 'Embed' I've
    changed it from 'Do not embed' to 'Embed & Sign', neither were
    successful.
  • I tried adding the AvailableHapticFeedback framework explicitly in the 'Frameworks, Libraries, and Embedded Content', but Xcode complains of a duplicate, so removed it.

  • I've made sure there is no value in the Packaging section -
    'Executable Prefix'

Can anyone suggest anything else to help me fix this issue, please?

Andy4202
  • 31
  • 5
  • Does the solution for https://stackoverflow.com/questions/59994746/dyld-could-not-load-inserted-library-but-works-on-simulator-and-another-iphone work for you? – Yonat Mar 08 '20 at 08:35
  • Thank you, but no it didn't work. From what I've read on that forum post it could be a bug with iOS 13.3.1 – Andy4202 Mar 08 '20 at 20:27
  • [https://stackoverflow.com/questions/60015309/running-ios-apps-causes-runtime-error-for-frameworks-code-signature-invalid][1] Can't comment. But this might help. – Jim lai Mar 09 '20 at 01:07

1 Answers1

0

I had a similar problem. The solution, for my case, was to properly embed the Framework.

In the main project root file, select your app target and change the Framework embed property from "Do Not Embed" to "Embed & Sign". In my case, this worked.

EmbedFrameworkImage

Filipe Canzi
  • 150
  • 5