问题
I'm trying to build and run an application that uses the AVFoundation framework ...
( I know that this is duplicate, but the solutions posted elsewhere don t help me.)
I build successfully but the app crashes when I re-run it from Xcode with the following error:
> dyld: Library not loaded: @rpath/libswiftAVFoundation.dylib
Referenced from : /private/var/containers/Bundle/Application/B9B93BB2-F55E-4DAE-A720-0F2D22A47278/FaceMarks.app/FaceMarks
Reason: no suitable image found. Did find:
/private/var/containers/Bundle/Application/B9B93BB2-F55E-4DAE-A720-0F2D22A47278/FaceMarks.app/Frameworks/libswiftAVfoundation.dylib:
>code signature invalid for '/private/var/containers/Bundle/Application/B9B93BB2-F55E-4DAE-A720-0F2D22A47278/FaceMarks.app/Frameworks/libswiftAVfoundation.dylib'
> lldb
The complete error message :
I have found many solutions, I have tested many of them but all of those not worked for me:
1) Clean, build and run an application
2) Set "Always Embed Swift Standard Libraries" to "Yes" under the Build Settings > Build Options
3) Restart Xcode
4) Restart the phone
5) Reinstall the Xcode
6) Testing other simple application on my iPhone ( App contains just a print function )
Note: That the test app works fine on the simulator but on my iPhone it gives the same error
dyld: Library not loaded: @rpath/libswiftCore.dylib
回答1:
Code signing issues are usually account related, so if you're using a free Apple dev account that carries certain limitations and expiration issues with it.
Firstly, make sure you have a valid and active developer account logged into Xcode under:
Xcode | Preferences | Accounts
Alternatively remove the developer account shown there and add it back in again.
Secondly make sure that the account specified under Preferences | Accounts matches what you have selected for your project target under:
<TargetName> | Signing & Capabilities
回答2:
I fixed this error by using a paid developer account.
回答3:
For all those still looking for a solution, I have a free dev account and solved it like this:
The problem is that you must first "trust" your account on your iPhone, and trust apps made from this developer.
See instruction with screenshots here: https://entirefaq.helpdocs.com/mobile-apps/iphone-app-how-to-fix-the-untrusted-enterprise-developer#:~:text=Tap%20Settings%20%3E%20General%20%3E%20Profiles%20or,prompt%20to%20confirm%20your%20choice.
回答4:
Even with the paid developer account, I had to include the $(inherited) in the linker flags at the top. This actually did the trick. Secondly, I started having this issue in the release enterprise build, the reason was the certificate was not trusted to I had to add the Certificate Authority relevant to that certificate to make it valid.
来源:https://stackoverflow.com/questions/60384835/dyld-library-not-loaded-code-signature-invalid