2016-09-23 62 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,然后移除该框架。