generate_multiple_pod_projects 是CocoaPods 1.7.0 加入的新的屬性,主要是將pod中的文件以project的形式加入到項(xiàng)目中。在使用generate_multiple_pod_projects后會(huì)有一個(gè)新的問(wèn)題產(chǎn)生,就是在post_install 中使用下面的方式無(wú)法獲取到配置項(xiàng):
post_install do |installer_representation|
installer_representation.pods_project.targets.each do |target|
target.build_configurations.each do |config|
end
end
end
主要原因是這時(shí)候的pod這個(gè)時(shí)候pod下面的文件是以project形式存在,所以這時(shí)候不能直接去獲取targets來(lái)配置項(xiàng)目配置了,需要修改為下面的獲取方式:
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