user6358496
user6358496

Reputation:

dyld: Library not loaded: code signature invalid

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 doesn'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 :

enter image description here

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
  1. Set "Always Embed Swift Standard Libraries" to "Yes" under the Build Settings > Build Options
  1. Restart Xcode
  1. Restart the phone
  1. Reinstall the Xcode
  1. 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

enter image description here

Upvotes: 0

Views: 5392

Answers (5)

BaptisteB
BaptisteB

Reputation: 1258

Are you using the -deep signing flag? It can cause this problem.

See "--deep Considered Harmful".

Upvotes: 0

SaadurRehman
SaadurRehman

Reputation: 660

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.

Upvotes: 0

Suisse
Suisse

Reputation: 3613

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.

Upvotes: 0

user6358496
user6358496

Reputation:

I fixed this error by using a paid developer account.

Upvotes: 1

EarlGrey
EarlGrey

Reputation: 2543

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

Upvotes: 2

Related Questions