在将Swift类添加到旧的Xcode项目后,我得到这个错误。

dyld:库未加载:@rpath/libswift_stdlib_core.dylib

我怎样才能使项目再次运行?


当前回答

我试了上面给出的所有答案,都没用。

终于工作后更新到优胜美地

其他回答

对我来说,之前的解决方案都没用。我们发现在构建设置中有一个标记ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES(在早期版本中:“嵌入式内容包含Swift代码”)需要设置为YES。默认是NO !

解决方案6:

在我们的案例中,企业分销证书已被撤销。生成一个新的证书并更新配置配置文件解决了这个问题。

(这个错误似乎有很多不同的原因。希望这能帮助到一些人。)

发生这种情况的原因有很多。刚刚度过了一个有趣的周末,发现了另一个导致这个问题的问题(代码签名的顺序),我想创建一个总结答案,将所有可能的解决方案放在一起:

Add Embedded Content Contains Swift Code to project. You need to set this flag if your app contains Swift code. Clean project. In addition to a Project > Clean you can also delete the DerivedData and Build directories. Look under the Preferences for the location of DerivedData. Build should be in your project folder. Ensure Runpath Search Paths contains @executable_path/Frameworks. Ensure that your certificate contains your Apple Team ID in the OU (Organization Unit) field Apple will add this for you, just revoke your existing distribution certificate and create a new one, download, install on KeyChain, regenerate all provisioning profiles, download those and rebuild. Xcode restart. If everything is basically good, but Xcode hasn't gotten there yet.

这很简单。如果你正在进行自己的命令行构建,你可能会创建自己的.ipa文件来上传。在这种情况下,您需要确保以下内容:

Make sure the version of the Swift files in SwiftSupport/iphoneos is the same as the version in Contents/YourApp.app/Frameworks Because Swift is not yet binary compatible between version, you must ensure these versions are the one that you built your app with. You can find these libraries under /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphoneos. Sign the libraries and frameworks first. You need to codesign the libraries and framework files (under Frameworks in the .app folder) first and then sign the entire .app tree. The .app tree must be signed with an entitlements.plist but not the frameworks.

希望当Swift 3.0问世时,我们不再需要将Swift捆绑到我们的应用程序中,这个问题就会消失。

我也遇到过这个问题,只是没有定位libswiftXCTest.dylib。

解决方案是在Build Phases/Link Binary with Library中将XCTest.framework添加到Tests目标中。即使当我试图构建主目标时,我也会得到这个错误。

我在这个问题上研究了很久。有几个原因导致这个问题。

如果你在objective - C项目中使用Swift代码/库,你应该尝试解决方案1-2-3

如果你正面临这个问题,一个新的Swift项目解决方案4将最适合你。

解决方案1:

重启Xcode,然后重启电脑和iPhone

解决方案2:

转到项目构建设置,并设置始终嵌入Swift标准库(以前的嵌入式内容包含Swift代码)标志为YES

解决方案3:

进入项目构建设置,将@executable_path/Frameworks添加到Runpath搜索路径选项

解决方案4:

如果以上都不起作用,那么应该这样做。正如AirSign的帖子中提到的,苹果似乎是忍者补丁证书

At InHouse证书

主题:UID=269J2W3P2L, CN=iPhone分布:公司名称,O=公司名称,C=FR

他们添加了一个名为OU的新字段

主题:UID=269J2W3P2L, CN=iPhone分布:公司名称,OU=269J2W3P2L, O=公司名称,C=FR

因此,您应该重新创建证书和供应