xcode dyld:库未加载:@rpath/libswiftContacts.dylib
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34986456/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
dyld: Library not loaded: @rpath/libswiftContacts.dylib
提问by Mannam Brahmam
dyld: Library not loaded: @rpath/libswift_stdlib_core.dylib
dyld:库未加载:@rpath/libswift_stdlib_core.dylib
dyld: Library not loaded: @rpath/libswiftCore.dylib. Issue persist
dyld:库未加载:@rpath/libswiftCore.dylib。问题持续存在
I know that theses question have been answered several times, but "dyld: Library not loaded: @rpath/libswiftContacts.dylib"I have not been able to find a proper solution to this error when I am coding a Swift application for XCode 7.2:
我知道这些问题已被多次回答,但是“dyld:库未加载:@rpath/libswiftContacts.dylib”当我为 XCode 7.2 编写 Swift 应用程序时,我无法找到正确的解决方案:
Here I use Contact & ContactUI Frameworks:: @rpath/libswiftContacts.dylib
这里我使用 Contact & ContactUI Frameworks:: @rpath/libswiftContacts.dylib
dyld: Library not loaded: @rpath/libswiftContacts.dylib
Referenced from: /var/mobile/Containers/Bundle/Application/C0F2B5CB-628C-4643-9473-648D3099D8FB/HomeMadeFood_User.app/HomeMadeFood_User
Reason: image not found
I have tried all these actions:
我已经尝试了所有这些操作:
- Restarting Xcode, iPhone, computer
- Cleaning & rebuilding
- Revoking and creating new certificate/provision profile
- Runpath Search Paths is '$(inherited) @executable_path/Frameworks'
- Embedded Content Contains Swift Code is 'Yes'
- Code Signing Identity is developer
deleting Xcode's Derived Data directory.
- 重启 Xcode、iPhone、电脑
- 清洁和重建
- 撤销和创建新的证书/配置文件
- 运行路径搜索路径是 '$(inherited) @executable_path/Frameworks'
- 嵌入的内容包含 Swift 代码是“是”
- 代码签名身份是开发人员
删除 Xcode 的派生数据目录。
I tried like this: but i am getting an error like:
我是这样尝试的:但我收到如下错误:
/Users/mac-jarc/Library/Developer/Xcode/DerivedData/HomeMadeFood_User-bmwdevsopruaqxfrbibhaspidobn/Build/Products/Debug- iphoneos/HomeMadeFood_User.app/Frameworks/Contacts.framework: bundle format unrecognized, invalid, or unsuitable
Command /usr/bin/codesign failed with exit code 1
回答by Aliya Aziz
I had this same error for a couple of weeks:
几个星期以来,我遇到了同样的错误:
dyld: Library not loaded: @rpath/libswiftContacts.dylib
Basically I was able to run and test my app on device. Then about 2 weeks ago, I wasn't able to run the tests on device anymore. Tests were running fine on simulator. I can't think what changed. The error I saw was the one above. I searched Google for ages trying to find a solution, and tried many fixes unsuccessfully. The fix that finally worked was to delete the Derived Data. Once I did this, I was once again able to run the tests on my device.
基本上我能够在设备上运行和测试我的应用程序。然后大约 2 周前,我无法再在设备上运行测试。测试在模拟器上运行良好。我想不出有什么变化。我看到的错误是上面那个。我在谷歌上搜索了很长时间试图找到解决方案,并尝试了许多修复失败。最终奏效的修复方法是删除派生数据。完成此操作后,我再次能够在我的设备上运行测试。
Fix that worked for me:
修复对我有用:
Go to Xcode > Preferences > Locations > Derived Data (click on little arrow to open up the folder in finder) e.g.
/Users/[username]/Library/Developer/Xcode/DerivedData
Delete the entire DerivedData folder
Clean/Build
Test on device - finally works again
转到 Xcode > Preferences > Locations > Derived Data(点击小箭头打开 finder 中的文件夹)例如
/Users/[username]/Library/Developer/Xcode/DerivedData
删除整个 DerivedData 文件夹
清理/构建
在设备上测试 - 终于再次工作
回答by Mazyod
In our case, it was clear that there was a bug in the way Xcode was resolving dependencies to our target.
在我们的例子中,很明显 Xcode 解析目标依赖项的方式存在错误。
Let's me start by saying, the solution was:
首先让我说,解决方案是:
import PassKit
Now, before you raise that eyebrow, here is why this worked:
现在,在你扬起眉毛之前,这就是为什么这样做有效:
- We relied on a Swift framework that imports
PassKit
- We distributed the prebuilt binary to team members
- The team observed the crash, just as OP mentioned it
- Adding that import in the app target made Xcode embed the required swift libraries
- 我们依赖于导入的 Swift 框架
PassKit
- 我们将预构建的二进制文件分发给团队成员
- 团队观察到了崩溃,正如 OP 提到的那样
- 在应用程序目标中添加该导入使 Xcode 嵌入所需的 swift 库
Note: Just linking PassKit in the GUI did absolutely nothing.
注意:只是在 GUI 中链接 PassKit 完全没有任何作用。
回答by Shyam Bhat
Cracked it.
破解了。
Check if the framework you're trying to build or one of it's dependency framework uses any of the Swift standard libraries. If yes, create a NEW key in the build settings
检查您尝试构建的框架或其依赖框架之一是否使用任何 Swift 标准库。如果是,请在构建设置中创建一个新密钥
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;
ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = 是;
回答by daxh
I know this is old question, but this is what helped meSpeaking shortly:
我知道这是个老问题,但这对我有帮助简短地说:
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
回答by Varun
This error is caused due to invalid certification of Apple.
这个错误是由于苹果的无效认证造成的。
Go to your keychain access. Under "Keychains" select "System" and under "Category" select "Certificates". Check whether the "Apple Worldwide Developer Relations Certification Authority" is valid or not. If not download that certificate from Apple site. It'll solve the problem.
转到您的钥匙串访问。在“Keychains”下选择“System”,在“Category”下选择“Certificates”。检查“Apple Worldwide Developer Relations Certification Authority”是否有效。如果没有从 Apple 网站下载该证书。它会解决问题。