duplicate symbol _OBJC_METACLASS_$_ClassName

前端 未结 18 1934
被撕碎了的回忆
被撕碎了的回忆 2020-12-15 15:10

I am trying to run my cocos2d application and facing this error, as I have recently upgraded my sdk to 4.2 and my cocos2d to 0.99.5.

I tried to clean my project even

18条回答
  •  隐瞒了意图╮
    2020-12-15 16:02

    I had a project with 2 targets. A target named Component and the second named Sample. Sample was using component as a link library. Then Component was using a pod named MyPod (installed with cocoapod).

    The Podfile was written like this :

    def shared_pods
       pod 'MyPod' 
    end
    
    target 'Component' do
        shared_pods  
    end
    
    target 'Sample' do
        shared_pods
    end
    

    Both targets was referencing the shared pod list. When building Component target, no problem appears, but when building sample i get a duplicate symbol _OBJC_METACLASS_$_ClassName. I have changed the Podfile to :

    def shared_pods
        # empty
    end
    
    target 'Component' do
       pod 'MyPod'
       shared_pods  
    end
    
    target 'Sample' do
        shared_pods
    end
    

    And that solve the problem. 3 hours spent, hope to save somebody time.

提交回复
热议问题