嵌入内容包含使用 Xcode 8 Beta 的 Swift 代码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38792650/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:07:13  来源:igfitidea点击:

Embedded Content Contains Swift Code with Xcode 8 Beta

objective-cswiftxcodecompilation

提问by Oguz Demir

I am developing a command line macOS application(with Objective-C) which uses other 3rd party Swift libraries. I am retrieving an error says "dyld: Library not loaded: @rpath/libswiftAppKit.dylib"

我正在开发一个命令行 macOS 应用程序(使用 Objective-C),它使用其他 3rd 方 Swift 库。我正在检索一个错误说“ dyld: Library not loaded: @rpath/libswiftAppKit.dylib

Previous answers recommend to set "Embedded Content Contains Swift Code" flag to true. However, this flag is missing with Xcode 8 beta.

以前的答案建议将“嵌入式内容包含 Swift 代码”标志设置为 true。但是,Xcode 8 beta 缺少此标志。

I have tried "ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES", which i believe a new flag for Xcode 8. It doesn't work either :(

我试过“ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES”,我相信这是 Xcode 8 的一个新标志。它也不起作用:(

Is anyone tried to compile and execute a command line application with Xcode 8 beta that is; - developed using Objective-C - having 3rd party swift library dependencies

是否有人尝试使用 Xcode 8 beta 编译和执行命令行应用程序;- 使用 Objective-C 开发 - 具有 3rd 方 swift 库依赖项

Update:

更新:

I ended up copying everything under "/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx" into the folder where the executable stands. Not a perfect solution but it works.

我最终将“ /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/macosx”下的所有内容复制到可执行文件所在的文件夹中。不是一个完美的解决方案,但它有效。

回答by Jorge Irún

Check this mentioned in Xcode 8 beta 2 Release Notes:

检查 Xcode 8 beta 2 发行说明中提到的这一点:

The new build setting ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES replaces the use of EMBEDDED_CONTENT_CONTAINS_SWIFT. This setting indicates that Xcode should always embed Swift standard libraries in a target for which it has been set, whether or not the target contains Swift code. A typical scenario for using this setting is when a target directly uses or embeds another product which contains Swift code.

新的构建设置 ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES 取代了 EMBEDDED_CONTENT_CONTAINS_SWIFT 的使用。此设置表示 Xcode 应始终将 Swift 标准库嵌入已为其设置的目标中,无论该目标是否包含 Swift 代码。使用此设置的典型场景是当目标直接使用或嵌入另一个包含 Swift 代码的产品时。

Note: EMBEDDED_CONTENT_CONTAINS_SWIFT has been deprecated. (26158130).

注意: EMBEDDED_CONTENT_CONTAINS_SWIFT 已被弃用。(26158130)。