Xcode 8.0 更新后架构 arm64 的重复符号

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/39512823/
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-09-15 09:15:24  来源:igfitidea点击:

duplicate symbols for architecture arm64 after Xcode 8.0 update

iosxcodearchitectureupdatesarm64

提问by Andreea Mateevici

I get duplicate symbols error after I updated my Xcode. (find the code down) Does anybody get this too? And how could be solved?

更新我的Xcode. (找到代码)有人也得到这个吗?以及如何解决?

I tried to remove -ObjClinker flag from the "Other Linker Flags" section, check after imported .minstead of .h, switch the "No Common Blocks" compiler setting to NO, I went to Targets -> Build Phases -> Compilesources and no duplicates there, tried all with no results.

我试图-ObjC从“其他链接器标志”部分中删除链接器标志,在导入后检查.m而不是.h,将“无公共块”编译器设置切换为“否”,我去了Targets -> Build Phases -> Compile源代码,那里没有重复,尝试了所有没有结果。

Any other ideas?

还有其他想法吗?

duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/FollowingUserViewController.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/ChatViewController.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/MessagesNotifications.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/AppDelegate.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/PicturesCell.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SMAPMainViewController.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/CheckUserTypeViewController.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SmaptersNearYou.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/PostSlider.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/UserSettings.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventSliderCell.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/UserProfile.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventCell.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/NewsFeed.o duplicate symbol _textViewMaxHeight in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventSliderCell.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/ExpressSliderCell.o duplicate symbol _textViewStandardHeight in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventSliderCell.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/ExpressSliderCell.o duplicate symbol _textViewStep in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventSliderCell.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/ExpressSliderCell.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/FollowerUserViewController.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/FilterAlertView.o duplicate symbol _space in: /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/UserNotificationsViewController.o ld: 20 duplicate symbols for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

重复符号 _space 在:/Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/ a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/FollowingUserViewController.o 重复符号_space在:/Users/a/Library /Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP -bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/ChatViewController.o 中的重复符号_space:/Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer /Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/MessagesNotifications.o 重复符号_space在:/Users/a/Library/Developer/Xcode/ DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvouqutn/Building中间体/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/AppDelegate.o 重复符号 _space 在:/Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer /Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/PicturesCell.o 重复符号_space在:/Users/a/Library/Developer/Xcode/ DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvouqutn/Building中间体/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SMAPMainViewController.o 中的重复符号_space:/Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer /Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/CheckUserTypeViewController.o 重复符号_space在:/Users/a/Library/Developer/Xcode/ DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvouqutn/Building中间体/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SmaptersNearYou.o 重复符号_space:/Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer /Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/PostSlider.o 重复符号_space在:/Users/a/Library/Developer/Xcode/ DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvouqutn/Building中间体/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/UserSettings.o 重复符号_space:/Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer /Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventSliderCell.o 重复符号_space在:/Users/a/Library/Developer/Xcode/ DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvouqutn/Building中间体/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/UserProfile.o 重复符号_space:/Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer /Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventCell.o 重复符号_space在:/Users/a/Library/Developer/Xcode/ DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvouqutn/Building中间体/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/NewsFeed.o 重复符号 _textViewMaxHeight 在:/Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventSliderCell.o /Users/a/Library/Developer /Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/ExpressSliderCell.o 重复符号_textViewStandardHeight 在:/Users/a/Library/Developer/Xcode/ DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventSliderCell.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubzvoub Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/ExpressSliderCell.o 重复符号_textViewStep in:/Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/EventSliderCell.o /Users/a/Library/Developer /Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/ExpressSliderCell.o 重复符号_space在:/Users/a/Library/Developer/Xcode/ DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvouqutn/Building Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/FollowerUserViewController.o 中的重复符号_space:/Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer /Xcode/DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/FilterAlertView.o 重复符号_space在:/Users/a/Library/Developer/Xcode/ DerivedData/SMAP-bshetjpaaresiudzvoubtutnfvuq/Build/Intermediates/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/SearchView.o /Users/a/Library/Developer/Xcode/DerivedData/SMAP-bshetjpaaresiudzvouqutn/Building中间体/SMAP.build/Debug-iphoneos/SMAP.build/Objects-normal/arm64/UserNotificationsViewController.o ld:架构 arm64 clang 的 20 个重复符号:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

回答by Renish Dadhaniya

Below Patch work for me..:)

下面的补丁对我来说有效..:)

Code recommended to use warning flags and set GCC_NO_COMMON_BLOCKS to YES.

代码建议使用警告标志并将 GCC_NO_COMMON_BLOCKS 设置为 YES。

Setting it back to NO solved the problem!enter image description here

将其设置回 NO 解决了问题!在此处输入图片说明

回答by JorisH

I finally found it! You can compile after setting enable testabilityto NOin your Build settings.

我终于找到了!您可以在Build settings中将enable testability设置为NO 后进行编译

Changed settings

更改设置

From The Xcode 8 Release Notes:

来自Xcode 8 发行说明

When the Enable Testability build setting is enabled, Xcode 8 will pass -export_dynamic to the linker to preserve all global symbols for testing. This effectively overrides dead code stripping, which can expose link failures from unused functions that reference undefined symbols. If necessary, disabling testability will allow the link to proceed without source changes. (27684883)

启用 Enable Testability 构建设置后,Xcode 8 会将 -export_dynamic 传递给链接器以保留所有全局符号以进行测试。这有效地覆盖了死代码剥离,这可以从引用未定义符号的未使用函数中暴露链接失败。如有必要,禁用可测试性将允许链接在不更改源的情况下继续进行。(27684883)

Of course, the best thing to do is to either: a) remove the unused code that is causing the linker issues, or b) actually fix the linker issues.

当然,最好的办法是:a) 删除导致链接器问题的未使用代码,或 b) 实际修复链接器问题。

回答by sfratini

I understand most people are solving this by either the No Common Blocks or the Dead Code setting, but that is actually a workaround for the real issue. In my case, I was using a Pod file that was adding the same libraries I already had linked, so basically I removed the duplicate files in my Build Phases link libraries that were already compiled in my Pod file and the Archive feature worked.

我知道大多数人是通过 No Common Blocks 或 Dead Code 设置来解决这个问题的,但这实际上是解决真正问题的方法。就我而言,我使用的 Pod 文件添加了我已经链接的相同库,所以基本上我删除了我的 Build Phases 链接库中的重复文件,这些文件已经在我的 Pod 文件中编译,并且存档功能有效。

回答by Andreea Mateevici

I found that I had constants declared in each 2 different classes, in .m file. This was allowed before this new version of xCode, but now appears like duplicate even those 2 classes don't import eachother and has nothing to do one with another.

我发现我在 .m 文件中的每个 2 个不同的类中都声明了常量。这在这个新版本的 xCode 之前是允许的,但现在看起来像是重复的,即使这两个类不相互导入并且彼此没有任何关系。

const NSInteger space = 10; <-- the name "space" should be unique over the app, even it's in .m file

const NSInteger 空间 = 10; <-- 名称“空间”在应用程序中应该是唯一的,即使它在 .m 文件中

回答by Ted

for my case, Xcode 9, we were declaring constants in some header file

对于我的情况,Xcode 9,我们在一些头文件中声明了常量

Constants.h

常量.h

static NSString *const kSomeString = @"SomeString";

so importing Constants.h in multiple .m files causes the duplicated symbols

所以在多个 .m 文件中导入 Constants.h 会导致重复的符号

Solution:

解决方案:

Constants.h

常量.h

extern NSString * const kSomeString;

Constants.m

常数.m

NSString *const kSomeString = @"SomeString";

回答by Fahad Qasim

In your Xcode 9 project you will see left hand side 3 column search icon click that then search for: -Objc in the search bar and then you will see a pod config file open that. Now remove the -ObjC from the inherited it will solve the issue.

在您的 Xcode 9 项目中,您将看到单击左侧的 3 列搜索图标,然后在搜索栏中搜索:-Objc,然后您将看到一个 pod 配置文件打开它。现在从继承中删除 -ObjC 它将解决问题。

回答by Razvan

These are the steps that I took to resolve this issue:

这些是我为解决此问题而采取的步骤:

  1. Select the first duplicated compiled source … Search for something in the error message like: CDVWKWebViewEngine or EventSliderCell.o in your case;
  2. Select your project in XCODE (top left) then select Build Phases;
  3. In the filter text field enter the compile source that has been reported as duplicated (e.g. CDVWKWebViewEngine);
  4. You should receive at least 2 results for that source - one in cordova-plugin-ionic-… and another in cordova-plugin-wkwebview-...;
  5. Select the cordova-plugin-wkwebview-… one and click on the “-“ sign (bottom left);
  6. Now try to build again and do this for all the compile sources that are duplicated.
  1. 选择第一个重复的编译源……在错误消息中搜索一些内容,例如:CDVWKWebViewEngine 或 EventSliderCell.o 在你的情况下;
  2. 在 XCODE(左上角)中选择您的项目,然后选择 Build Phases;
  3. 在过滤器文本字段中输入已报告为重复的编译源(例如 CDVWKWebViewEngine);
  4. 对于该源,您应该至少收到 2 个结果 - 一个在 cordova-plugin-ionic-... 中,另一个在 cordova-plugin-wkwebview-... 中;
  5. 选择cordova-plugin-wkwebview-...一个,然后点击“-”号(左下角);
  6. 现在尝试再次构建并对所有重复的编译源执行此操作。

回答by thardes2

The solution is in thispost. You're not up to date with this, but at least it solves the problem for now and at least in my scenario I don't have any problems with that version.

解决方案在这篇文章中。你不是最新的,但至少它现在解决了这个问题,至少在我的情况下,我对那个版本没有任何问题。

回答by Michael Yang

From the error info, it must be some file dupicate in your project. Such as FilterAlertView, UserNotificationsViewController, SearchView, ExpressSliderCell...,And so on. You can see this in your error info.

从错误信息来看,它必须是您项目中的某个文件重复。如FilterAlertView、UserNotificationsViewController、SearchView、ExpressSliderCell...等。您可以在错误信息中看到这一点。

回答by user387184

I did not want to change any of these settings since no one really knows what other side effects these may have. So I iust globally searched for that variable name, replaced the name the caused the conflict in one class to variable_Classname.

我不想更改这些设置中的任何一个,因为没有人真正知道它们可能产生的其他副作用。所以我只是全局搜索了那个变量名,将一个类中引起冲突的名称替换为variable_Classname。

That solved the issue for me without changing any setting

在不更改任何设置的情况下为我解决了问题