Dyld: library not loaded: @ rpath / libswiftAVFoundation.dylib Reason: image not found

I get this error when starting my application. I am building under Xcode 9.0 (9A235) on MacOS High Sierra 10.13. I also tried building under Xcode 8.3.3 with the same result. A project is typically a C object, but the YouAppi.framework structure is a Swift:

dyld: Library not loaded: @rpath/libswiftAVFoundation.dylib Referenced from: /private/var/containers/Bundle/Application/7D3E2815-4CA3-4258-AEF6-C0626055A8F2/dingbats.app/Frameworks/YouAppi.framework/YouAppi Reason: image not found 

At first glance this seems like a duplicate of this question , but in this case the error is different. In this other β€œReason” question, no suitable image was found where my image was not found .

I tried to solve the following:

  • Delete and re-add framework
  • Clear and select + Clear project
  • Delete folder ~ / Library / Developer / Xcode / DerivedData li>
  • Build Settings -> Always Insert Standard Swift Libraries = Yes
  • Build Settings -> Strip Swift Symbols = No
  • Build Settings -> Linking -> Runpath Path Finder -
    • added by @loader_path
    • added by @rpath
    • added @ executable_path / Frameworks
  • Verified developer and distribution certificates for which Trust is set (Use system defaults)
  • Checked that I have the latest WWDR and G2 certificates installed.
  • Validation of the above certificates
  • Moved YouAppi.framework to the Frameworks / folder. (It was originally in a third-party folder.)
  • Test copy libswiftAVFoundation.dylib to the folder with the project files

I have not recently switched to a new computer.

I have the same result on my iPhone 7+ running iOS 11.0.23 (15A432), as well as the iPad Mini 1 with iOS 9.3.5 (13G36).

Also tried the following:

 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 

Ideas?

+5
source share
2 answers

When you enable the framework created using Swift in a project other than Swift, you must copy the standard Swift libraries to the final output. Xcode has a checkbox for this (# 4 in the original question), but apparently there is an error where in some cases this does not actually happen.

I saw somewhere another thread that said this happens when you have a structure built using Swift that is built for several architectures like armv7 and arm64. (See section here .)

In any case, the solution is to add them all manually. The files you are looking for are in /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos .

I have done this:

Step 1. Open Terminal and enter this by copying the libraries to the new swiftStdLib folder in your home directory.

 cd /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos mkdir ~/swiftStdLib cp libswift*.dylib ~/swiftStdLib 

Step 2. Inside Xcode, go to General β†’ Embedded binaries and click + to add. Click Add another , then go to the / swiftStdLib home folder. Highlight everything and press enter.

Step 3. Clean and create a project.

Hope this helps someone.

+6
source

Removing old developer certificates from Keychain Access helped me.

0
source

Source: https://habr.com/ru/post/1272627/


All Articles