2016-11-09 20 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