library not found for -lPods-AFNetworking

2019-02-08 07:01发布

I am getting the following error when using AFNetworking:

''library not found for -lPods-AFNetworking''
"linker command failed with exit code 1 (use -v to see invocation)."

I checked for all missing frameworks,and they are all present .Additionally this project works for other people(we pulled it from github) and I'm the only person for whom it does not work.(its a joint project)

We all use Xcode 6.2. I do not understand what could be wrong or what went missing. I tried pulling using the command line,sourceTree and even from Xcode git source control.

I also tried different versions of Xcode. But all the other teamates are using Xcode 6.2, which I am using now.

It used to work before, it suddenly stopped working.

Any ideas are welcome,thank you!

Following is the detailed errors:

ld: warning: directory not found for option '-L/Users/ramapriyasridharan/Documents/Rama-3:06:2015-ios/Mapbox' ld: warning: directory not found for option '-L/Users/ramapriyasridharan/Documents/Rama-3:06:2015-ios/Pods/build/Debug-iphoneos' ld: library not found for -lPods-AFNetworking clang: error: linker command failed with exit code 1 (use -v to see invocation)

EDIT:

After opening the workspace file, I did not get the mach O linker error any more, but I am getting the following error:

Command /Volumes/Xcode 1/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/momc failed with exit code 1

I asked my team mates who said that it still works fine,so it is still a problem only on my computer!

7条回答
Viruses.
2楼-- · 2019-02-08 07:06

Instead of opening the XCode project, you should open up the WorkSpace file.

查看更多
叼着烟拽天下
3楼-- · 2019-02-08 07:10

I had the same error while migrating my project to iOS 9. I solved it by doing this:

  1. Navigate to the Build Settings tab for your project and search for "link".
  2. In the the Other Linker Flags section, remove -l"Pods-AFNetworking" and replace it with -l"AFNetworking"

See the screenshot linked here for more information:

http://i.stack.imgur.com/uG51T.png

查看更多
Deceive 欺骗
4楼-- · 2019-02-08 07:13

I wanted to write an answer myself because two things together worked :

  1. AS @Helium3 mentioned, I had to open the workspace rather than the project file in the file explorer(projectname.xcworkspace file)(I actually have 2 and only 1 seems to work!)

  2. As @Muhammad Adnan mentioned in the comments, what worked was to install pod and update pod it solved the linker problems!!(Note: This should be done in the project directory,make sure cocoapods are installed first!!), in addition it gave me odd errors at first(after a second go),later it was alright!

Thank you guys!

查看更多
聊天终结者
5楼-- · 2019-02-08 07:25

React native:

I forgot to install a new RN module after pulling changes. So don't forget to npm i or yarn before building with react-native.

查看更多
做个烂人
6楼-- · 2019-02-08 07:28

I was facing the same problem and following solution worked for me:

  1. Go to project setting -> build setting -> other linker flag, and remove all flags that have -lpod or frameworks or related to pods. Don't remove the required flags (e.g. -ObjC, -licucore, -libxml2)
  2. Add a flag $(inherited) at the top.
  3. Clean the project and compile.
查看更多
Juvenile、少年°
7楼-- · 2019-02-08 07:30

In iWatch App using Cocoa Pods AFNetworking i got the Same issue.

I Just Solved Issue ....

Just Follow this Step.

[1] Open your project's podfile by typing in terminal:

open -a Xcode Podfile

Check If you are Using AFNetworking than using

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

pod 'AFNetworking', '~> 3.0'

copy and paste this between target 'iChat' do .... end

Like .....

target 'iChat' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for iChat

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'

pod 'AFNetworking', '~> 3.0'

end

and

[2] Then open your terminal again simply paste it.

pod install

Now open App.xcworkspace and Clear and Run You can see Error is Gone Now...

查看更多
登录 后发表回答