ios 架构 i386 的 6 个重复符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/15520921/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 22:48:37  来源:igfitidea点击:

6 duplicate symbols for architecture i386

iphoneiosobjective-ccompiler-errorssbjson

提问by Ali Maisam

duplicate symbol _OBJC_METACLASS_$_SBJsonParser in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonParser.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonParser.o)
duplicate symbol _OBJC_CLASS_$_SBJsonParser in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonParser.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonParser.o)
duplicate symbol _OBJC_IVAR_$_SBJsonWriter.sortKeys in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
duplicate symbol _OBJC_IVAR_$_SBJsonWriter.humanReadable in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
duplicate symbol _OBJC_METACLASS_$_SBJsonWriter in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
duplicate symbol _OBJC_CLASS_$_SBJsonWriter in:
    /Users/Gaditek/Library/Developer/Xcode/DerivedData/DietBet-gyhoyhmdrobtqregldjyixtgmize/Build/Intermediates/DietBet.build/Debug-iphonesimulator/DietBet.build/Objects-normal/i386/SBJsonWriter.o
    /Users/Gaditek/Desktop/AliMaisamProjects/Dietbet/DietBet/libfacebook_ios_sdk.a(SBJsonWriter.o)
ld: 6 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Please tell me how to fix this issue?

请告诉我如何解决这个问题?

回答by Nikolai Ruhe

As you can see the linker complains that SBJsonWriterand SBJsonParserare both defined in libfacebook_ios_sdk.a and as individual files in your project.

正如您所看到的,链接器抱怨SBJsonWriter并且SBJsonParser都在 libfacebook_ios_sdk.a 中定义,并作为项目中的单个文件。

You cannot really solve the problem except removing the individual files from your target.

除了从目标中删除单个文件之外,您无法真正解决问题。

The problem is that the developers of libfacebook_ios_sdk.a thought it would be a good idea to use the json framework (not caring for clashes with code used in the host app). This is a common problem with SDKs on iOS.

问题是 libfacebook_ios_sdk.a 的开发人员认为使用 json 框架是个好主意(不关心与主机应用程序中使用的代码的冲突)。这是 iOS 上 SDK 的常见问题。

回答by Piyush

I had resolved issues please follow step.

我已经解决了问题,请按照步骤操作。

  1. Goto application's target
  2. Compile Sources
  3. Remove duplicate file using (-).enter image description here
  1. 转到应用程序的目标
  2. 编译源
  3. 使用 (-) 删除重复文件。在此处输入图片说明

回答by joacar

The problem is most likely due to a typo when including the header. Check so that the header file (.h) is included and not the implementation file (.m).

问题很可能是由于包含标题时的拼写错误造成的。检查以确保包含头文件 (.h) 而不是实现文件 (.m)。

This was the issue for me

这对我来说是个问题

回答by Trevor Assaf

Something that often helps if nothing else works is to open your .pbxcodeproj file with a text editor and grep for the name of the class that is coming up in the failure log in Xcode. There might be two duplicate lines - delete one of them.

如果没有其他方法,通常会有所帮助的方法是使用文本编辑器打开 .pbxcodeproj 文件,并 grep 获取 Xcode 中出现的故障日志中出现的类的名称。可能有两行重复 - 删除其中之一。

回答by Kunal

You must have added SBJsonParser.h/.m twice in the project.

您必须在项目中两次添加 SBJsonParser.h/.m。

回答by rohan-patel

It seems you probably have some .h/.m file included twice like included some third party API/library twice, or you created some new file whose name is exactly same as already available file in project. Check out if you have any files which is duplicate in your project folder.

似乎您可能两次包含一些 .h/.m 文件,例如两次包含某些第三方 API/库,或者您创建了一些新文件,其名称与项目中已有的文件完全相同。检查您的项目文件夹中是否有任何重复的文件。

回答by Ivan Vavilov

You also can:

您还可以:

  1. Copy .hfiles of conflict pods.
  2. Delete these conflict podsfrom podfile.
  3. Copy these .hfiles to project.
  4. Rename at #import</.h>to ".h"of copied .hfiles.
  5. Make pod installand bulid.
  1. 复制.h冲突的文件pods
  2. 删除这些冲突podspodfile
  3. 将这些.h文件复制到项目中。
  4. 在重命名#import</.h>,以".h"复制的.h文件。
  5. 制造pod install和建造。

The trick is your code have no error because .hfiles imported, but .ofiles link correctly.

诀窍是您的代码没有错误,因为.h文件已导入,但.o文件链接正确。

回答by zapoo

if you import any of your .h file twice it happens.

如果您将任何 .h 文件导入两次,就会发生这种情况。

For example If you import any .h file both ....ViewController.h and ....ViewController.m file it happens.

例如,如果您同时导入任何 .h 文件 ....ViewController.h 和 ....ViewController.m 文件,它就会发生。

回答by Narasimha Nallamsetty

If above all don't solve your issue, check whether you declare a constant in two different files(I mean check if you have two same(.h &.m) files. Duplicate files should not be there in your project.

如果以上都不能解决您的问题,请检查您是否在两个不同的文件中声明了一个常量(我的意思是检查您是否有两个相同的(.h &.m)文件。您的项目中不应存在重复文件。