Cocoapods 1.1.1 目标覆盖了`ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES`

Cocoapods 1.1.1 target overrides the `ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES`

我已经为我的 XCode 8 Swift 2.0 项目更新到 cocoapods 1.1.1,现在我收到警告“...目标覆盖 ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES .. 。”在控制台中。我该如何解决这个问题?

这是我的播客文件

platform :ios, '9.0'
use_frameworks!

def app_pods
 pod 'Alamofire', '~> 4.0.0'
 pod 'AlamofireObjectMapper','~> 4.0.0'
 pod 'RealmSwift', '~> 2.0.2'
 pod 'KeychainAccess', '~> 3.0.0'
 pod 'ReachabilitySwift', '~> 3'
 pod 'SwiftyBeaver', '~> 1.0.1'
 pod 'GoogleAnalytics', '~> 3.17.0'
end

def unit_tests
 app_pods
 pod 'OHHTTPStubs', '~> 5.2.1'
 pod 'OHHTTPStubs/Swift', '~> 5.2.1'
end 


target 'Demo' do
 app_pods
end

target 'App1' do
 app_pods
end

target 'App2' do
 app_pods
end

target 'DemoTests' do
 unit_tests
end

target 'App1Tests' do
 unit_tests
end

target 'App2Tests' do
 unit_tests
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

此问题已在以下拉取请求中修复https://github.com/CocoaPods/CocoaPods/pull/6068 and it should be out in cocoapods version 1.1.2 . I got the info from the following github issue https://github.com/CocoaPods/CocoaPods/issues/6067

我通过执行以下操作解决了这个问题:

  1. 进入构建设置
  2. 顶部select 所有组合
  3. 在构建选项下,您应该看到 Always Embed Swift Standard Libraries,它是粗体的。
  4. 点击它,然后点击删除。现在应该取消加粗。
  5. Pod 安装和 error/errors 应该消失了!

它不会让我 post 图片,因为我没有足够的声誉,所以这里有一个详细的屏幕截图 link!

https://cloud.githubusercontent.com/assets/17066507/21532583/93df897e-cd1f-11e6-9f17-d25cb81a2a53.png

公认的解决方案有效,但现在您必须确保所有队友都在执行它 pod install

我们都知道他们不会。

您可以让 CococaPods 自动执行此操作,方法是将其添加到 Podfile:

的底部
post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            if config.name == 'MyPOD' 
                config.build_settings['ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'] = 'Yes'
            end
        end
    end
end

更多信息在这里:https://www.devsbedevin.net/cocoapods-always-embed-swift-standard-libraries/