Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode: ld: library not found for -lAFNetworking

Because of this one reason, build always fails...Any ideas about what I could try?

Because of this one reason, build always fails...Any ideas about what I could try?

EDIT: the solution is to open the xcworkspace instead of the xcproject!

like image 262
Akbapu Avatar asked Sep 18 '15 04:09

Akbapu


2 Answers

Might be you are opening .xcodeproj file after installing pods. Close the project and open .xcworkspace file.

like image 95
Jagdeep Singh Avatar answered Nov 11 '22 14:11

Jagdeep Singh


Have the same issue.

What I did with the help of https://premium.wpmudev.org/forums/topic/anybody-solved-this-linker-command-failed-with-exit-code-1 and Adlair Cerecedo-Mendez

  1. Delete the "Pods" project on the left panel of Xcode.
  2. Close Xcode and delete this file in the finder too.
  3. Install pods again.
  4. Open Xcode and clean.
  5. Verify that the build option "Build Active Architecture Only" is set to "NO" for your project but also for your Pods project (selection with left panel).
  6. Click on your project Scheme (top, near the stop button) and "Manage Scheme".
  7. Check, select all your pods libraries and close.
  8. Then, for all libs, select them (scroll the list) and build manually for the selected architecture.

Every time you change your architecture (simulator, device or for archive(Generic iOS Device)) you must do the above step: namely, manually build each libraries by selecting them in your scroll list one by one, and only than build and run your main project.

Seems a bit WTF, but it is the only way I resolve this issue...

like image 26
myz Avatar answered Nov 11 '22 15:11

myz