0

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

  • 11
    You should really copy and paste the actual errors themselves, not screenshots (and _definitely_ not _pictures of your screen_) – johnny Feb 24 '20 at 22:29
  • Sorry, but I'm using a Mac of a friend , I didn't have a time to just copy the error , I will try to update the question. –  Feb 24 '20 at 22:32
  • 1
    Does this answer your question? [dyld: Library not loaded: @rpath/libswiftAVFoundation.dylib](https://stackoverflow.com/questions/32771796/dyld-library-not-loaded-rpath-libswiftavfoundation-dylib) – Evgeny Karkan Feb 24 '20 at 22:58
  • I have seen this answer, but it does not work, I have mentioned in the post that I have tested many solutions but any of those worked for me. –  Feb 24 '20 at 23:01
  • Looks like there is a legitimate issue with free apple developer accounts using external frameworks as of iOS 13.3.1: https://stackoverflow.com/a/60101963/4608154. However, I'm not sure this applies here since the framework you're using isn't external. – johnny Feb 25 '20 at 00:05
  • @wilc0 I think that was my problem, Thanks for you reply ,unfortunately there is no solution for this error –  Feb 25 '20 at 00:17

5 Answers5

2

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
EarlGrey
  • 2,514
  • 4
  • 34
  • 63
  • The developer account that I have created is free ( not a paid developer account ). Did you agree that this may be causing the error? –  Feb 24 '20 at 23:38
  • Every week, I was able to install the application because the free account developer gives me only 7 days to test, but it works and it did not give me any error, so the last week I have updated my iPhone X, ( security updates for ios 13.3.1 ), after updates, the apps crash every time after update, I have removed it and I tried to install again ( build and re-run ) from Xcode, Today I get encountered this error. –  Feb 24 '20 at 23:41
  • Yes, code signing issues are usually account related, so I wouldn't be surprised if your free account had some sort of a limitation or an expiration. – EarlGrey Feb 24 '20 at 23:42
  • Can you tell me what is the solution for that? Create a new developer account did solve this issue? –  Feb 24 '20 at 23:43
0

I fixed this error by using a paid developer account.

0

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.

Suisse
  • 3,467
  • 5
  • 36
  • 59
0

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.

SaadurRehman
  • 622
  • 8
  • 20
0

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

See "--deep Considered Harmful".

double-beep
  • 5,031
  • 17
  • 33
  • 41
BaptisteB
  • 1,168
  • 2
  • 9
  • 16