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

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

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


当前回答

重启Xcode就解决了这个问题。

其他回答

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

尝试按住Alt键,然后进入产品->清洁构建文件夹…

希望它能帮助到一些人。

参考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.

我也有同样的问题。我的解决方案是将每个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代码/库,你应该尝试解决方案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

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