0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Cocoapodsと__has_includeのマクロが相性よくなさそう

Posted at

AppDelegateなどで、
__has_includeを使ったマクロを書いていたとします。
MyFacebookToolsは、FacebookSDKを使って色々やっているクラスだと思ってください。

# if __has_include(<FacebookSDK/FacebookSDK.h>)
# import "MyFacebookTools.h"
# endif

システムテストの時だけFaecebookSDKが必要になる予定だったので、
Podfileを以下のようにします。

platform :ios, '6.0'

target :MyUnitTest do
    pod 'GHUnit', '~> 0.5.9'
    pod 'MyCustomFramework', :path => '../MyCustomFramework'
end

target :MySystemTest do
    pod 'GHUnit', '~> 0.5.9'
    pod 'Facebook-iOS-SDK', '~> 3.23'
    pod 'MyCustomFramework', :path => '../MyCustomFramework'
end

これでpod installをしてMyUnitTestのターゲットをビルドすると、
MyFacebookToolsクラスがFacebookSDKのクラスを参照しているけど
Facebook SDKがないよ的なLinker errorが出てきます。。。

そこでPodfileを編集してシステムテストのターゲットをコメントアウトします。

platform :ios, '6.0'

target :MyUnitTest do
    pod 'GHUnit', '~> 0.5.9'
    pod 'MyCustomFramework', :path => '../MyCustomFramework'
end

# target :MySystemTest do
#    pod 'GHUnit', '~> 0.5.9'
#    pod 'Facebook-iOS-SDK', '~> 3.23'
#    pod 'MyCustomFramework', :path => '../MyCustomFramework'
# end

するとエラーが消えました!
他のターゲットで読み込んだpodも影響してしまうようです。。。

同じような症状のissueがOpenのままだったので、対応中なのかもしれません。

Per-configuration pods don't work with __has_include()

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?