LoginSignup
2
1

More than 5 years have passed since last update.

CocoaPods 管理の Facebook iOS SDK 3.23.0 で weak reference エラーを回避する方法

Last updated at Posted at 2016-04-14

エラー

CocoaPodsで依存管理している Facebook iOS SDK 3.23.0 でビルドエラーが発生。
メッセージ内容: Cannot create __weak reference in file using manual reference counting

マニュアルでPodsのプロジェクトファイルをいじることでローカルではビルドできるようになったものの、Jenkinsで自動ビルドする際に

pod update

を走らせているので、設定が巻き戻ってしまい、ビルドに失敗した。

対処方法

Podfileに、pod install / updateの後に走らせるスクリプトを記述できるので、そこに下記を記述する。

post_install do | installer |
    classy_pods_target = installer.pods_project.targets.find{ |target| target.name == 'Facebook-iOS-SDK' }
    classy_pods_target.build_configurations.each do |config|
        config.build_settings['CLANG_ENABLE_OBJC_WEAK'] = 'YES'
    end
end

余談

CLANG_ENABLE_OBJC_WEAKという魔法の言葉を探す方法。

Pasted image at 2016_04_14 19_26.png

参考サイト

本家サイト: https://guides.cocoapods.org/syntax/podfile.html#post_install

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1