CocoaPods generate_multiple_pod_projects设置

generate_multiple_pod_projects 是CocoaPods 1.7.0 加入的新的属性,主要是将pod中的文件以project的形式加入到项目中。在使用generate_multiple_pod_projects后会有一个新的问题产生,就是在post_install 中使用下面的方式无法获取到配置项:

post_install do |installer_representation|
   installer_representation.pods_project.targets.each do |target|
     target.build_configurations.each do |config|
    end
  end
end

主要原因是这时候的pod这个时候pod下面的文件是以project形式存在,所以这时候不能直接去获取targets来配置项目配置了,需要修改为下面的获取方式:

post_install do |installer_representation|
  installer_representation.generated_projects.each do |project|
    project.targets.each do |target|
      target.build_configurations.each do |config|
      end
    end
  end
end

你可能感兴趣的:(CocoaPods generate_multiple_pod_projects设置)