我现在也有同样的问题,但还没有找到正确的答案。我得到了错误:

    /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Intermediates/TestMoboSDK-Client.build/Debug-iphonesimulator/TestMoboSDK-Client.build/Objects-normal/x86_64/MoboSDK.o
    /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Products/Debug-iphonesimulator/libMoboSDK.a(MoboSDK.o)
duplicate symbol _OBJC_METACLASS_$_MoboSDK in:
    /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Intermediates/TestMoboSDK-Client.build/Debug-iphonesimulator/TestMoboSDK-Client.build/Objects-normal/x86_64/MoboSDK.o
    /Users/nle/Library/Developer/Xcode/DerivedData/TestMoboSDK-Client-cgodalyxmwqzynaxfbbewrooymnq/Build/Products/Debug-iphonesimulator/libMoboSDK.a(MoboSDK.o)
ld: 75 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

任何帮助都是感激的。

最后,我找到了这个错误的原因,因为我添加了-ObjC到其他链接器标志。在删除这个值之后,我可以成功地构建我的项目,但我不知道为什么。有人能解释一下吗?


当前回答

对于React Native,解决方案是简单地删除所有的库:Target > Build Phases > Link Binary with Library。

我真的不知道原因,但我认为React Native已经安装了包,创建副本。

其他回答

在我的案例中,我在项目中定义了两个main()方法,删除其中一个就解决了这个问题。

对我来说,在Xcode8推荐的项目设置中将“No Common Blocks”更新为YES,这导致了这个问题。

今天,我得到了同样的错误。错误的关键字是duplicate。我通过:

1. Remove the duplicate file at Build Phases-->Compile Sources
2. If you can not remove it at Build Phases, you need find the file at your project and remove the reference by DELETE :

3. Add the file to your project again
4. Add the file's .m to your Build Phases-->Compile Sources again
5. Build your project, the error will disappear

当我添加一个pod存储库时,我得到了同样的错误

pod 'SWRevealViewController'

对于已经添加的源代码(SWRevealViewController)从gitHub。因此,该错误将通过删除源代码或pod存储库来修复。

案例2:

第二次,当我在.h文件中声明一个常量时,出现了这个错误。

NSString * const SomeConstant  = @"SomeValue";
@interface AppDelegate : UIResponder <UIApplicationDelegate> {
...
...

删除-ObjC从其他链接标志或 请检查是否误导入了。m文件而不是。h文件。