ld: framework not found error in xcode 8

喜你入骨 提交于 2019-12-10 11:07:53

问题


I am using xcode 8 for development and cocoapods 1.0.1 for frameworks. After installing frameworks, i couldn't able to build my project. I am getting "ld: framework not found" error. I am using following lines in pod file:

# 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

回答1:


After installing the frameworks, did you closed your project and opened the newly created workspace?

Once you start using CocoaPods to install framework, you must use the workspace as it includes your Sample project and the Pod project containing the frameworks.

In you project directory, make sure to open the .xcworkspace instead of .xcodeproj.

Edit: If that is not the issue, go to your Sample target/General/Linked Framework and Librairies

You should only have one that should be name something like: Pods_Sample.framework

If you are only using cocoa pods to install frameworks it should be the only one there as it includes all the pods.




回答2:


select your target -> General ->Embedded Binary , click + ,and add Alamofire.framework




回答3:


try adding project 'APP_NAME.xcodeproj' to your podfile after use_frameworks! and do pod install again

if you receive warnings like below, after 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

Go to Build Settings of your target and add $(inherited) to Framework Search Paths




回答4:


I had this problem, and it happened a while after renaming my project. It was using my Pod_Old_Project_Name as a framework.

I fixed this by going to Build Phases -> Link Binary With Libraries, and removed that framework.




回答5:


There are two reasons this error occurs

  1. I have faced the same issue, This comes only due to change in the pod file or maybe the pod file may not exist, double check the pod file and run the cmd pod install

  2. After successfully installing the pod file still if you getting this
    error please restart the Xcode, error goes away



来源:https://stackoverflow.com/questions/39661296/ld-framework-not-found-error-in-xcode-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!