2014-10-18 96 views
45

我想問一下,然後回答這個問題。目標覆蓋FRAMEWORK_SEARCH_PATHS構建設置

我想更新內置到我的應用程序中的CocoaPods,所以我從終端運行pod install

這時候,我得到這個錯誤:

[!] The `APP_NAME [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation 
- Use the `$(inherited)` flag, or 
- Remove the build settings from the target. 

你怎麼使用$(繼承)標誌?

回答

86

選擇項目,targets->應用程序,然後Build Settings,我增加了$(繼承)線,刪除任何特定莢之前已經提及有:

enter image description here

我希望這可以幫助別人。

+1

Thx。我必須刪除指定的pod,並且必須用您提到的$(繼承)來替換它。 – palme 2015-01-21 16:39:55

+1

在我的情況下,我需要添加$(PROJECT_DIR) – kakashy 2016-02-22 16:58:03

+0

這個答案是一個漫長而漫長的搜索的結束。感謝您發表回覆和評論。 – AndrewHenderson 2017-03-18 03:59:15

10

我也遇到過這個問題。

除了做Peter上面提到的,請記住仔細檢查您的podfile中是否選擇了正確的Xcode項目。這是因爲您可能正在更改不正確的Xcode項目的Build Settings。這是一個愚蠢的錯誤,但我花了很長時間才意識到它。

如果目錄中只有一個.xcodeproj文件,通常情況下,pod install將自動工作。但是,如果您正在將您的項目從舊的手動添加框架/第三方項目的方式遷移到您的Xcode項目中,那麼您的文件夾中可能會有多個.xcodeproj文件。執行上述修復並不能解決問題,因爲我正在編輯不正確的.xcodeproj文件。

轉到您的項目目錄,檢查名爲Podfile的文件,並確保您指定的xcodeproj

# Uncomment this line to define a global platform for your project 
# platform :ios, '8.0' 
# Uncomment this line if you're using Swift 

use_frameworks! 
xcodeproj 'APP_NAME.xcodeproj' 
target 'APP_NAME' do 

# Your dependencies here 
# pod 'NAME_OF_DEPENDENCY' 
pod 'Google/CloudMessaging' 
pod 'RxSwift', '~> 2.0' 
pod 'RxCocoa', '~> 2.0' 
pod 'RxBlocking', '~> 2.0' 
pod 'Fabric' 
pod 'Crashlytics' 
pod 'FBSDKCoreKit' 
pod 'FBSDKLoginKit' 
pod 'FBSDKShareKit' 

您Podfile選擇正確.xcodeproj後,轉到Xcode和執行以下操作:

  1. 從左側的Project Navigator中選擇您的項目。
  2. 在中央屏幕,去Build Settings
  3. 添加過濾器「框架搜索路徑」
  4. 輸入$(inherited)作爲值;它應該自動填充數據評估表達式

下面是Xcode與版本7.2(7C68)的圖像。

Xcode preview

+1

只需要注意一下:CocoaPods 1.3.1給出了一個棄用警告:「''xcodeproj'已被重命名爲'project',請相應地更新您的Podfile。 – AmitaiB 2017-09-24 18:08:04