1)在Xcode中,我创建了一个新的命令行OSX @L_502_1@应用程序并添加了他们的示例“class Dog”代码,并在顶部添加了“import RealmSwift”.
2)我添加一个包含两行的Podfile,“use_frameworks!”和“pod’FynmSwift’”然后运行pod安装.
3)我打开工作区,编译并运行.我收到这个警告:
Not running swift-stdlib-tool: EMBEDDED_CONTENT_CONTAINS_SWIFT is enabled,but the product type ‘Command-line Tool’ is not a wrapper type.
而这次崩溃:
dyld: Library not loaded: @rpath/libswiftAppKit.dylib
Referenced from: /Users/ys1382/Library/Developer/Xcode/DerivedData/testRealmApp-gxysfwfiirxwddbklmbolznecnld/Build/Products/Debug/RealmSwift.framework/Versions/A/RealmSwift
Reason: image not found
到目前为止,谷歌搜索表明警告和崩溃是相关的.有什么建议?
我正在使用OSX El Capitan,Xcode 7.2.1,Cocoapods 0.39.0
- Create an Objective-C command line tool and change the Search Paths.
Not Swift. You can create a Swift framework for the code you’d put in your command line tool,but the tool itself must not compile any Swift code. Doing so will confuse the linker and make it see duplicate declarations of the Swift library (one in the shipped .dylib,another embedded in the command line tool).
This presentation显示了一种不同的方法,从创建Cocoa应用程序开始,然后以31个步骤将其强制转换为命令行应用程序.
就在那时我想,“mmmaybe我的命令行工具毕竟可以使用一些漂亮的图形”,而是制作了一个Cocoa OSX Swift Realm Cocoapod应用程序.