Linker command failed with exit code 1 (use -v to see invocation) with Swift 3

老子叫甜甜 提交于 2019-12-24 03:11:08

问题


I am working on building a Swift library and am hosting it on GitHub.

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)

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.

I did convert BluetoothKit to Swift 3 when I added it.

There is one class that uses BluetoothKit and it is called NPFBluetooth.

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.


回答1:


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...)

The solution is to delete the content of your 'derived data' folder.

Works for frameworks installed with Carthage and cocoapods.....




回答2:


Go to your build settings and switch the target's settings to ENABLE_BITCODE = YES for now. It's working for me ;)



来源:https://stackoverflow.com/questions/38226316/linker-command-failed-with-exit-code-1-use-v-to-see-invocation-with-swift-3

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!