我正在尝试使用MetaWear cocoapod从我的IOS应用程序连接到BLE传感器。在添加这个pod之前,我用Xcode创建了一个基本的单视图应用程序。我尝试在我的iPhone上编译和运行它,它如预期的那样出现。
完成此操作后,我执行了pod初始化,并将我的Podfile更新为如下所示,如上面的MetaWear cocoapod链接中所建议的:
platform :ios, '12.2'
target 'myProj' do
use_frameworks!
pod 'MetaWear', '~> 3.2'
end一旦我运行"pod install",我就会得到以下输出:
Analyzing dependencies
Downloading dependencies
Using Bolts-Swift (1.4.0)
Using MetaWear (3.2.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.然后我打开我的Xcode项目( myApp.xcworkspace ),当我尝试重新构建该项目时,我总是收到这个错误:
Could not build Objective-C module 'BoltsSwift'下图也显示了这一点:

因此,我的印象是,也许我应该降级BoltsSwift版本,但指定低于1.4的值似乎被忽略了。例如,我添加了这个pod:
pod 'Bolts-Swift', '~> 1.3'在运行pod install之后,我的输出仍然是"Using Bolts-Swift (1.4.0)“。因此,我不太确定如何摆脱这种编译失败。也许降低BoltsSwift的等级并不是正确的做法。我可以尝试什么?(我使用的是Xcode版本10.2.1 (10E1001))
发布于 2019-05-02 03:28:32
好的,事实证明,在默认情况下,对于BoltsSwift和MetaWear pod,XCode将我的Swift编译设置为5.0。我把它改成了Swift 4,这样我就可以构建了。

更新pods编译级别也可能是一个好主意,如下所述:
How to set the Legacy Swift Version for each Pod in Podfile Xcode 9.0 Swift 3.2 / Swift 4.0
https://stackoverflow.com/questions/55941149
复制相似问题