duplicate symbols for architecture armv7

前端 未结 16 1635
遥遥无期
遥遥无期 2020-12-01 01:46

Getting following error when try to use Layar SDK in my existing app. How can I solve this?

Ld /Users/pnawale/Library/Developer/Xcode/DerivedData/hub-afxxzaq         


        
相关标签:
16条回答
  • 2020-12-01 02:39

    This error can also be caused if you have cyclic imports.... lets suppose you have VC1.h, VC2.h, and VC3.h

    examples that will cause the error: (all are the .h files)

    • If VC2 imports VC1 and VC1 imports VC2
    • If VC1 imports VC2 and VC2 imports VC3 and VC3 imports VC1

    solution:

    • import inside the .m instead of the .h
    • if the .h needs that class use @class (nameOfClass); instead of importing the .h

    Be careful when using #import, only import what you need.

    0 讨论(0)
  • 2020-12-01 02:42

    I was seeing the same issue, but with different libraries. The fix was the following:

    Target -> Build Phases -> Linked Binary With Libraries
    

    Make sure the libraries included make sense. In my case, my project had libPods*.a (I am using CocoaPods for dependency mgmt) but also a few libraries that were included in my pod shared libraries, and that was causing the duplicates.

    0 讨论(0)
  • 2020-12-01 02:43

    The only thing that worked for me was to delete my Podfile and then reinstall it.

    Make sure you make a copy of all of your original pods before running the following:

    $ sudo gem install cocoapods-deintegrate
    
    $ sudo gem install cocoapods-deintegrate cocoapods-clean
    
    $ rm -rf ~/Library/Developer/Xcode/DerivedData
    
    $ pod deintegrate
    
    $ pod clean
    
    $ rm Podfile
    
    $ pod cache clean --all
    
    $ pod init
    
    // next add all the original pods to the new Podfile
    
    $ pod install
    
    0 讨论(0)
  • 2020-12-01 02:46

    My problem was... odd. I'm not sure how it happened, but at some point, Xcode decided to include some ancient .m file one more time in its .pbxproj file. The only way I found it was by comparing my changes in git, looking at the version of the code where the build first failed.

    Simply removing this line solved my issue:

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