Arn*_*aud 78 ios facebook-login cocoapods swift4 xcode9-beta
更新到Xcode 9后,我尝试构建我的一个项目.
我使用FacebookLogin pod.我在FacebookLogin/LoginButton.swift中有编译器错误
@testable import FacebookCore
? Module compiled with Swift 3.1 cannot be imported in Swift 4.0
Run Code Online (Sandbox Code Playgroud)
在我的目标构建设置中,Swift语言版本设置为Swift 3.2.
我想我需要等待Facebook更新他们的pod?还是其他任何建议?
谢谢 !
xav*_*als 72
更新:
解决方案还在Swift 4.2和Xcode 10中进行了测试和工作.
原版的:
我想补充一点,如果您使用Carthage在Swift 3.2中编译模块,您应该去终端并运行:
sudo xcode-select --switch /Applications/Xcode-beta.app/Contents/Developer
Run Code Online (Sandbox Code Playgroud)
要使用Xcode 9命令行工具,您可以运行:
carthage update NameOfTheLibrary --platform iOS --no-use-binaries
Run Code Online (Sandbox Code Playgroud)
这将使用您当前的命令行工具编译库,它可能有点慢,但现在应该构建项目.
注意
要恢复和使用稳定的Xcode命令行工具,只需运行:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Run Code Online (Sandbox Code Playgroud)
kli*_*ger 26
Xcode 9附带一个Swift 4编译器,可以理解Swift 3.2和swift 4,它甚至可以让你在两个版本之间进行混合和匹配.不幸的是,不支持其他版本.
即使您将语言设置为Swift 3.2,它也会使用Swift 4编译器.
如果你正在使用cocoapods,你可以将它添加到pod文件的末尾以强制pod使用Swift 3.2或4.0:
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['SWIFT_VERSION'] = '3.2'
end
end
end
Run Code Online (Sandbox Code Playgroud)
或者,您可以暂时将文件从pod直接放入项目,直到FacebookLogin更新为Swift 3.2或4.
注意:根据Matt的反馈进行编辑
Xu *_*Yin 11
我在Xcode 9 Beta 3上遇到了同样的问题,指向'Alamofire'并尝试了一些不同的解决方案,我找到的最简单的解决方案是
1. CMD+SHIFT+K to clean the build
2. Restart Xcode 9 <-- make sure you do this step, that's critical. `
Run Code Online (Sandbox Code Playgroud)
goto xcode DerivedData目录然后删除其中的所有文件并重新编译您的项目.它对我有用.
默认的DerivedData目录是:〜/ Library/Developer/Xcode/DerivedData.
如果使用Carthage,打开终端和;
carthage update --platform iOS --no-use-binaries
Run Code Online (Sandbox Code Playgroud)
如果使用Pod,打开终端和;
pod update
Run Code Online (Sandbox Code Playgroud)
(如果在pod中不起作用,您可以在podfile Ex中更改SWIFT_VERSION:
config.build_settings['SWIFT_VERSION'] = '3.2'
Run Code Online (Sandbox Code Playgroud)
)
后;
打开Xcode并使用;
Command+Option+Shift+K
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
36060 次 |
| 最近记录: |