简体   繁体   English

dyld:库未加载:代码签名无效

[英]dyld: Library not loaded: code signature invalid

I'm trying to build and run an application that uses the AVFoundation framework ...我正在尝试构建和运行一个使用 AVFoundation 框架的应用程序......

( 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:我构建成功,但是当我从 Xcode 重新运行它时应用程序崩溃并出现以下错误:

> 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清理、构建和运行应用程序
  1. Set "Always Embed Swift Standard Libraries" to "Yes" under the Build Settings > Build Options在 Build Settings > Build Options 下将“Always Embed Swift Standard Libraries”设置为“Yes”
  1. Restart Xcode重启Xcode
  1. Restart the phone重启手机
  1. Reinstall the Xcode重新安装Xcode
  1. Testing other simple application on my iPhone ( App contains just a print function )在我的 iPhone 上测试其他简单的应用程序(应用程序只包含打印功能)

Note: That the test app works fine on the simulator but on my iPhone it gives the same error注意:测试应用程序在模拟器上运行良好,但在我的 iPhone 上它给出了同样的错误

dyld: Library not loaded: @rpath/libswiftCore.dylib dyld:库未加载:@rpath/libswiftCore.dylib

在此处输入图片说明

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.代码签名问题通常与帐户相关,因此如果您使用的是带有某些限制和过期问题的免费 Apple 开发帐户。

Firstly, make sure you have a valid and active developer account logged into Xcode under:首先,确保您有一个有效且活跃的开发者帐户登录到 Xcode 中:

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 |其次确保在 Preferences | 下指定的帐户Accounts matches what you have selected for your project target under:帐户与您为项目目标选择的内容相匹配:

<TargetName> | Signing & Capabilities

我使用付费开发者帐户修复了这个错误。

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.问题是你必须首先“信任”你在 iPhone 上的账户,并信任这个开发者制作的应用程序。

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 .在此处查看带有屏幕截图的说明: 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

Even with the paid developer account, I had to include the $(inherited) in the linker flags at the top.即使使用付费开发者帐户,我也必须在顶部的链接器标志中包含$(inherited) 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.其次,我在发布企业版本中开始遇到这个问题,原因是证书不受信任,我必须添加与该证书相关的证书颁发机构才能使其有效。

Are you using the -deep signing flag?你在使用-deep签名标志吗? It can cause this problem.它可能会导致此问题。

See " --deep Considered Harmful".参见“ --deep认为有害”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM