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

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

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


当前回答

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

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

其他回答

在这里尝试了好几个月之后……疯狂的定义…在一个新的Mac用户下启动Xcode为我解决了这个问题。

我删除了~/Library/Developer/*并重新安装了Xcode-所以不知道还要格式化什么才能使它工作。

我也有同样的问题。我的解决方案是将每个pod声明移动到目标子句中。

来自:

pod 'SomePod1'
pod 'SomePod2'
pod 'SomePod3'
target 'MyAwesomeApp', :exclusive => true do

end

To:

target 'MyAwesomeApp', :exclusive => true do
    pod 'SomePod1'
    pod 'SomePod2'
    pod 'SomePod3'
end

我的猜测是,如果pod声明放在目标声明之外,CocoaPods(0.39.0)可能会使用错误的xcconfig。

Pods.debug.xcconfig (X

Pods-MyAwesomeApp.debug.xcconfig (O

如果在Objective-C项目转换为开始使用Swift的过程中出现了错误,就会发生此错误。问题是链接器构建设置从未正确配置,所以你必须手动完成。寻找Runpath Search Paths构建设置并将其设置为:

$(inherited) @executable_path/Frameworks

编辑:我还应该补充一点,最近有大量的错误完全是由其他原因引起的——苹果对Swift本身进行了更改,可能从Xcode 6.1或6.1.1开始。唯一的解决方案似乎是退出Xcode,在Keychain Access中销毁你的证书,到会员中心删除所有证书和配置文件(除了应用商店中的配置文件-你不能删除它们),然后从头开始整个证书请求过程。

对我来说,这个问题是由于我的苹果全球开发者关系认证机构无效。

从这里下载: https://developer.apple.com/certificationauthority/AppleWWDRCA.cer

拖放到Keychain Access中,清理项目,然后运行。

参考https://forums.developer.apple.com/thread/21292

这个解决方案对我很有效:

It occurred on my side when building an app in the command line via xcodebuild and xcrun PackageApplication, signing the app with an enterprise profile. On our CI build servers, the certificate was set to "Always Trust" in the keychain (select certificate -> Get Info -> Trust -> "Use System Default" can be changed to "Always Trust"). I had to set it back to "Use System Default" in order to make this work. Initially we set this to "Always Trust" to work-around the keychain dialogs that appear after software updates and certificate updates.