ld: library not found for -lAFNetworking xcode
18,958
Solution 1
The error message indicates that the library was not found.
Make sure that:
- You see the AFNetworking in your Pods directory.
- Your Pods directory is in the search paths. Go to the project -> Build Settings -> Search for 'search paths' and make sure that your Pods directory is there. You can add it by adding "${PROJECT_DIR}/Pods" for example.
Solution 2
also make sure you are running the .xcworkspace project (white icon),not the .xcodeproj project (blue icon)
Solution 3
add $(inherited)
flag to LIBRARY_SEARCH_PATHS
at build settings
in Xcode target.
Solution 4
1.Remove Path from Other Linker flags 2.Clean the build 3.Run the code
Solution 5
please try to install COCOAPOD app in your mac.
Try to re attached AFNetworking here is the link please follow the instruction
Author by
c00der
Updated on July 27, 2022Comments
-
c00der almost 2 years
I am a total newbie to ios programming. Cloned a friends project. When trying to build (after resolving a lot of other errors), I get the following error:
ld: library not found for -lAFNetworking clang: error: linker command failed with exit code 1 (use -v to see invocation)
I checked the Pod file and searched for AFNetworking in the project, and it is there. Don't know what is going wrong.
-
c00der over 7 yearswith the help of Albert.Qing's answer at stackoverflow.com/questions/12002905/…, the problem was resolved. Thanks
-
c00der over 7 yearsHi, after doing that, I got another 20 errors apparently due to the AFnetworking version I was using. I changed it to version 2 on the Pod file and did pod install, now, again, I get the same error. What could be going wrong there?
-
little over 7 yearsCheck if indeed the Pod install updated the AFNetworking package. When running pod install it should list the version installed and you can also find it in the Podfile.lock. See also this link - guides.cocoapods.org/using/pod-install-vs-update.html
-
c00der over 7 yearsHi, yeah. It is installed. When I set the search paths, should it be for the project or the targets? To be safe, I set the search paths everywhere to be ${PODS_ROOT}; still no luck.
-
Arvind K. almost 3 yearsIf the project uses CocoaPods be aware to always open the .xcworkspace file instead of the .xcodeproj file