2016-11-09 313 views
1

我使用的CocoaPods 1.1.1和我podfile我有一个以上的post_install挂钩。而我得到这个错误:无效Podfile文件中指定多个post_install挂钩是不支持的

[!] Invalid `Podfile` file: [!] Specifying multiple `post_install` hooks is unsupported.. 
------------------------------------------- 
# 
> post_install do |installer| 
#  installer.pods_project.targets.each do |target| 

没有人面前面临同样的问题?是的!我有1个post_install在我的1个目标中,另一个在全局范围内。我可以在一个移动,但为什么?

回答

2

当我删除我的代码从我的主要目标,并在全球范围内的post_install块它像魅力的作品感动。

出于某种原因,如果你添加多个post_install(全球和1个目标例如)移动它们在同一个全局块,并添加如果其他管理目标的陈述。

1
def main_pods 
pod 'CocoaLumberjack', '2.0.0' 
pod 'MBProgressHUD', '0.9.1' 

post_install do |installer_representation| 
    installer_representation.pods_project.targets.each do |target| 

     if target.name == 'Pods-AFNetworking' 
      target.build_configurations.each do |config| 
       config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)'] 
       config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << '_AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_=1' 
      end 
     end 

    end 
end 

+1

请尝试去除post_install块。然后再试一次。及后每股警告“吊舱安装”现在 – mgyky

+0

好(如预期)“吊舱安装”工作正常,但是编译器现在向我展示了一些警告: 'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES'构建设置在'豆荚/目标支持文件/豆荚-的TargetName /荚定义-TargetName.xcconfig”。这可能会导致与CocoaPods安装 – arcangel06

+1

问题,我很高兴。现在检查你的警告在Xcode,如果Xcode中有某些设置更新,让它更新您的设置 – mgyky

相关问题