运行pod更新更改Pods构建设置

时间:2014-10-07 21:31:42

标签: ios cocoapods

当我跑步时

pod upate

针对我的Podfile,Pods项目的某些Build Settings for Architectures部分已更改:

  1. 支持的平台更改为OS X(来自iOS)
  2. 构建活动架构仅更改为是(从否)
  3. 将SDK从最新iOS
  4. 更改为No SDK(最新OS X)

    我不知道为什么要改变它。这可能是我在我的podspec文件中拥有(或没有)我的依赖项的东西吗?以下是我的podspec文件之一的示例:

    Pod::Spec.new do |spec|
      spec.name                  = 'pi-ios-sdk'
      spec.version               = '1.2.0'
      spec.license               = { :type => 'Copyright', :text => 'Copyright 2014 <...>. All rights reserved.' }
      spec.homepage              = 'http://<...>.com/'
      spec.authors               = '<...> Grid Mobile Frameworks Team'
      spec.summary               = '<...> Identity authentication GRID projects.'
      spec.description           = 'The <...> Identity Client iOS SDK framework (Pi-ios-client) assists in accessing the services provided by the <...> Identity API.'
      spec.ios.deployment_target = '7.1'
      spec.requires_arc          = true
      spec.source                = { :git => 'ssh://git@devops-tools.<...>.com/mp/pi-ios-sdk.git', :tag => 'tag/1.2.0' }
      spec.source_files          = 'framework/src/xcode/Pi-ios-client/*.{h,m}'
      spec.header_dir            = 'Pi-ios-client'
      spec.exclude_files         = 'framework/src/xcode/Pi-ios-client/PGMPiTokenRefreshOperationTests.m'
      spec.ios.frameworks        = 'Foundation', 'UIKit'
    end
    

    我的Podfile:

    platform :ios, "7.1"
    
    target "CourseListClient" do
      pod 'core-ios-sdk', '1.2.0'
      pod 'pi-ios-sdk', '1.2.0'
      pod 'classroom-ios-library', '0.1.0-SNAPSHOT'
    end
    
    target "CourseListClientTests" do
      pod 'core-ios-sdk', '1.2.0'
      pod 'pi-ios-sdk', '1.2.0'
      pod 'classroom-ios-library', '0.1.0-SNAPSHOT'
    end
    

    我在思考 - 对测试目标有相同的依赖关系可能是不必要的,但我还需要改变什么?谢谢。

1 个答案:

答案 0 :(得分:5)

在Podfile的末尾添加:

post_install do |installer_representation|
    projectSDK = nil

    puts"Updating all of the POD targets to not default to ONLY_ACTIVE_ARCH for debug"
    installer_representation.project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
            if projectSDK.nil?
                projectSDK = config.build_settings['SDKROOT']
            end
        end
    end
    puts "Updating ONLY_ACTIVE_ARCH for the project, as well. While the project settings aren't supposed to matter, I've not found that to be the case."
    puts "Also setting the base SDK of the project to match that of the targets (doesn't matter which one); otherwise it defaults to No SDK (Latest OS X)"
    installer_representation.project.build_configurations.each do |config|
        config.build_settings['ONLY_ACTIVE_ARCH'] = 'NO'
        config.build_settings['SDKROOT'] = projectSDK
    end
end

来源:Supported platforms, base SDK, build active architecture only settings reverted after pod update

如果您使用的是最新的gem(gem install cocoapods --pre),请替换2&#34; .project&#34;上面的&#34; .pods_project&#34;

问候