使用WatchKit扩展迁移到CocoaPods 1.1.1

时间:2016-11-21 21:41:06

标签: swift xcode cocoapods

我正在尝试从0.39迁移到最新版本的CocoaPods。这是我原来的podfile:

platform :ios, '10.0'
use_frameworks!

target 'MyApp' do
    pod 'SwiftyJSON'
    pod 'Alamofire', '~> 4.0'
    pod 'AlamofireImage', '~> 3.1'
end

target 'MyAppWatchKitApp' do

end

target 'MyAppWatchKitApp Extension' do

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.0'
    end
  end
end

阅读CocoaPods 1.0 Migration Guidethis StackOverflow post后,我尝试更新我的podfile:

platform :ios, '10.0'

target 'MyApp' do
    use_frameworks!

    pod 'SwiftyJSON'
    pod 'Alamofire', '~> 4.0'
    pod 'AlamofireImage', '~> 3.1'

    target 'MyAppWatchKitApp' do

    end

    target 'MyAppWatchKitApp Extension' do

    end

end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings['SWIFT_VERSION'] = '3.0'
    end
  end
end

保存podfile,在终端中运行pod update,然后打开并构建项目,我看到以下错误(客户端名称被删除,替换为" MyApp"以匹配上面的pod文件):

Screenshot of error

我尝试过的其他事情:

  • 除了pod install
  • 之外,还要pod update
  • 删除衍生数据

我对Swift和Xcode有一些很好的经验但是pod对我来说还是比较新的。也许我错过了一些非常基本的东西。非常感谢任何帮助!

1 个答案:

答案 0 :(得分:-1)

将此行添加到Podfile中的后安装步骤。   config.build_settings ['ONLY_ACTIVE_ARCH'] ='否'