2016-09-23 58 views
2

我使用xcode 8進行開發,並使用cocoapods 1.0.1進行框架。安裝框架後,我無法構建我的項目。我得到「ld:framework not found」錯誤。我正在使用POD文件下面幾行:ld:在xcode 8中找不到框架錯誤

# Uncomment this line to define a global platform for your project 
platform :ios, '9.0' 

target 'Sample' do 

use_frameworks! 

pod 'MBProgressHUD', '~> 0.9' 
pod 'TPKeyboardAvoiding', '~> 1.2' 
pod 'SDWebImage', '~> 3.7' 
pod 'UIActivityIndicator-for-SDWebImage' 
pod 'UITextView+Placeholder', '~> 1.2' 
pod 'Alamofire', '~> 4.0' 

end 

post_install do |installer| 
    installer.pods_project.targets.each do |target| 
     target.build_configurations.each do |config| 
      config.build_settings['SWIFT_VERSION'] = '3.0' 
     end 
    end 
end 
+0

「構建Alamofire 4.0.0+需要CocoaPods 1.1.0+」。根據這裏的文檔:https://github.com/Alamofire/Alamofire#migration-guides – Stephen

回答

1

選擇目標 - >常規 - >嵌入式二進制,單擊+,並添加Alamofire.framework

1

安裝框架後,你關閉你的項目,打開新創建的工作區?

一旦你開始使用CocoaPods來安裝框架,你必須使用工作區,因爲它包括你的Sample項目和包含框架的Pod項目。

在您的項目目錄中,請確保打開.xcworkspace而不是.xcodeproj。

編輯: 如果這不是問題,去你的樣品目標/一般/鏈接的框架並Librairies

您應該只有一個應該被命名類似:Pods_Sample.framework

如果你只使用可可豆莢來安裝框架,它應該是唯一的框架,因爲它包含了所有的豆莢。

0

嘗試use_frameworks!後加入project 'APP_NAME.xcodeproj'您podfile並再次執行pod install

如果您收到類似下面的警告,之後pod install

[!] The `APP_NAME [Debug]` target overrides the `FRAMEWORK_SEARCH_PATHS` build setting defined in `Pods/Target Support Files/Pods-BasePods-APP_NAME/Pods-BasePods-APP_NAME.debug.xcconfig'. This can lead to problems with the CocoaPods installation 

轉到構建設置你的目標的並添加$(inherited)框架搜索路徑

0

我有這個問題,並且在重命名我的項目後發生了一段時間。 它使用我的Pod_Old_Project_Name作爲框架。

我解決了這個問題,先進入Build Phases - > Link Binary With Libraries,然後移除該框架。