【问题标题】:Migrating to CocoaPods 1.1.1 with WatchKit Extension使用 WatchKit 扩展迁移到 CocoaPods 1.1.1
【发布时间】:2016-11-22 15:05:07
【问题描述】:

我正在尝试从 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 文件):

我尝试过的其他事情:

  • 除了pod update 之外,还做一个pod install
  • 删除派生数据

我在 Swift 和 Xcode 方面有一些很好的经验,但 pod 对我来说仍然相对较新。也许我错过了一些非常基本的东西。非常感谢任何帮助!

【问题讨论】:

    标签: swift xcode cocoapods


    【解决方案1】:

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

    【讨论】:

    • 感谢您的回复。我将您的代码紧跟在 podfile 中的 config.build_settings['SWIFT_VERSION'] = '3.0' 行之后,然后运行 ​​pod installpod update,清理并构建了我的项目,但仍然看到相同的错误。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-08-17
    • 2010-12-25
    • 2014-12-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多