Xcode: ld: library not found for -lAFNetworking

前端 未结 13 608
野趣味
野趣味 2021-02-02 06:24

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!

相关标签:
13条回答
  • 2021-02-02 06:39

    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.

    0 讨论(0)
  • 2021-02-02 06:43

    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.

    0 讨论(0)
  • 2021-02-02 06:44

    add $(inherited) at target -> your project -> build settings -> library search path

    0 讨论(0)
  • 2021-02-02 06:49

    Make sure Build Active Architecture Only is set to NO in the Pods project settings.

    0 讨论(0)
  • 2021-02-02 06:49

    I had this issue while using fastlane with a ReactNative project. I had added a dependency that required cocoapods.

    My Fastfile looked like this:

    ...
    gym(
      scheme: "AppName",
      project: "./ios/AppName.xcodeproj"
    )
    ....
    

    And had to change it to the workspace like this:

    ...
    gym(
      scheme: "AppName",
      workspace: "./ios/AppName.xcworkspace"
    )
    ...
    
    0 讨论(0)
  • 2021-02-02 06:51

    I encountered this error when I downloaded some code from github. I tried to build .xcodeproj file but it failed giving the library not found error. I then opened .xcworkspace file and build that file first by clicking Product -> Build for -> Running. The workspace file built fine with no errors. Then in workspace file I changed scheme to the xcode project I was trying to build, and clicked Product -> Run. The app got built and ran with no errors.

    0 讨论(0)
提交回复
热议问题