Module compiled with Swift 2.3 cannot be imported in Swift 3.0

偶尔善良 提交于 2019-12-19 14:19:11

问题


i add Facebook SDK (Swift) to my project. And now i update Xcode 8 and Swift 3. I have error in build time

Module compiled with Swift 2.3 cannot be imported in Swift 3.0 

It is very strange that is not supported. Has anyone had similar problems?


回答1:


Remember to set Use Legacy Swift Language Version to YES for your project target

You are building your project in 2.3 and not in 3.0




回答2:


Have in mind that if you want to use Swift 3 as your main project's language you have to use pods that are either Swift 3, or Swift 2.2-. If you try to use a Swift 2.3 project, they will not compile (as in the error you describe).

So the best thing to do is to use either Swift 3 pods, or Swift 2 (2.1 or 2.2) pods and select Use Legacy SLV for that specific pod (in 'Pods' build setting for the specific target you want to use).




回答3:


Currently the Facebook SDK does not yet support projects written in Swift 3.0.

There are a couple of issues you can subscribe to on their Github for updates.

You'll have to use Swift 2.3 for now. Facebook said it was planning to release an update soon after the GM was released, which has already happened, so it will probably come within the next few weeks.




回答4:


Try to remove all files under /tmp/Build/Products/... and /tmp/Build/Intermediates/... and Build again.




回答5:


This maybe a little late but changing the settings to\fro Yes and No didn't help me but just clearing my derived data from the simulators just made everything work.



来源:https://stackoverflow.com/questions/39484678/module-compiled-with-swift-2-3-cannot-be-imported-in-swift-3-0

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