Swift 3的链接器命令失败,退出代码为1(使用-v查看调用) [英] Linker command failed with exit code 1 (use -v to see invocation) with Swift 3
问题描述
我正在构建一个Swift库,并且正在将其托管在GitHub上.
I am working on building a Swift library and am hosting it on GitHub.
一切正常,直到我向项目添加了 BluetoothKit .然后我收到一个Apple Mach-O链接器错误:
All was going fine until I added BluetoothKit to the project. I then got an Apple Mach-O Linker Error:
ld: warning: directory not found for option '-F/Applications/Xcode-beta.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.0.sdk/Developer/Library/Frameworks'
ld: /Users/calebklevetertest/Library/Developer/Xcode/DerivedData/Napalm-dblvhbjdwovurocsvzrzaxzkjjyw/Build/Products/Debug-iphonesimulator/Napalm.framework/Napalm compiled with older version of Swift language (2.0) than previous files (3.0) for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
从阅读错误开始,似乎问题出在某种程度上是由于我使用的是Swift 3,但我不知道该如何解决.
From reading the error it appears the issue somehow stems from the fact I am using Swift 3, but I can't figure out how to fix it.
我确实在添加BluetoothKit时将其转换为Swift 3.
I did convert BluetoothKit to Swift 3 when I added it.
有一个使用BluetoothKit的类,它称为NPFBluetooth
.
There is one class that uses BluetoothKit and it is called NPFBluetooth
.
需要注意的几件事是:1)即使该类是公共类,编译器也会给出未解决的标识符"错误; 2)该类未在自动完成中显示; 3)所有其他类都可以正常工作
A couple things to note are 1) Even though the class is public, the compiler gives an error of 'unresolved identifier', 2) The class does not show in the auto-complete and 3) All the other classes work fine.
推荐答案
我在迁移到swift3时遇到了错误.事实证明,Xcode保留了已构建框架的副本,而转移到swift3显然不是重建那些框架的线索(即使在发现它是使用swift2构建之后……也不要让我们抛出一个模糊的错误……)
I ran into the error migrating to swift3. As it turns out Xcode keeps copies of built frameworks and moving to swift3 is apparently not a cue to rebuild those (even after finding out it was built using swift2.... no let's throw a vague error instead...)
解决方案是
适用于随Carthage和cocoapods安装的框架.....
Works for frameworks installed with Carthage and cocoapods.....
这篇关于Swift 3的链接器命令失败,退出代码为1(使用-v查看调用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!