Xcode: ld: library not found for -lAFNetworking

2019-03-11 16:23发布

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!

12条回答
叛逆
2楼-- · 2019-03-11 16:56

open xcode, from the top left select the pod library that is being shown as not found.Use 'Command B' to build this pod, then again select your target scheme and run.

For me this fixed it.

查看更多
仙女界的扛把子
3楼-- · 2019-03-11 16:57

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

查看更多
仙女界的扛把子
4楼-- · 2019-03-11 16:57

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...

查看更多
我命由我不由天
5楼-- · 2019-03-11 17:04

I'm thinking on two possibilities:

1) Install cocoapods-deintegrate project:

$ gem install cocoapods-deintegrate

Then run $ pod deintegrate, after that run $ pod install again. If it not works, then...

2) You can try open your Pods project and create new scheme for the target that you need, in this case for AFNetworking.

When the static library is created, then add it to your Frameworks references into your main project.

Hope that helps.

查看更多
▲ chillily
6楼-- · 2019-03-11 17:06

For me all this thing not help. Only delete in Build settings project.

enter image description here

查看更多
狗以群分
7楼-- · 2019-03-11 17:10

Had a similar issue ... took a while to realize that I had updated my app's "iOS Deployment Target" to iOS 9.0, but the Pods project's "iOS Deployment Target" was still iOS 8.0!!!

查看更多
登录 后发表回答