我更新Xcode
后出现重复符号错误。 (找到代码)有人也得到这个吗?怎么可以解决?
我尝试从"其他链接标记"中删除-ObjC
链接器标记。部分,在导入.m
而不是.h
后检查,切换" No Common Blocks"编译器设置为NO,我去了Targets -> Build Phases -> Compile
来源,没有重复,尝试了所有没有结果。
还有其他想法吗?
复制符号_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 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 复制符号_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 复制符号_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 复制符号_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 复制符号_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 复制符号_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 复制符号_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 复制符号_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 复制符号_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 复制符号_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 复制符号_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 复制符号_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 复制符号_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 重复符号_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 重复符号_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 重复符号_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 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 复制符号_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 复制符号_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:架构arm64的20个重复符号 clang:错误:链接器命令失败,退出代码为1(使用-v查看调用)
答案 0 :(得分:28)
答案 1 :(得分:19)
我终于找到了!您可以在构建设置中将启用可测试性设置为否后进行编译。
启用Enable Testability构建设置后,Xcode 8会将-export_dynamic传递给链接器以保留所有全局符号以进行测试。这有效地覆盖了死代码剥离,这可能会暴露引用未定义符号的未使用函数的链接失败。如有必要,禁用可测试性将允许链接在没有源更改的情况下继续。 (27684883)
当然,最好的办法是:a)删除导致链接器问题的未使用代码,或b)实际修复链接器问题。
答案 2 :(得分:6)
据我所知,大多数人都是通过No Common Blocks或Dead Code设置解决这个问题,但这实际上是真正问题的解决方法。在我的情况下,我使用的是一个Pod文件,它添加了我已经链接过的相同库,所以基本上我删除了我的Build Phases链接库中的重复文件,这些库已经在我的Pod文件中编译并且存档功能正常工作。
答案 3 :(得分:3)
我发现我在每个2个不同的类中声明了常量,在.m文件中。这是在xCode的这个新版本之前允许的,但是现在看起来像重复版,即使这两个类没有相互导入,也没有与另一个类无关。
const NSInteger space = 10; < - 名称“space”在应用程序上应该是唯一的,即使它在.m文件中
答案 4 :(得分:1)
对于我的情况, Xcode 9 ,我们在某些头文件中声明了常量
<强> Constants.h 强>
static NSString *const kSomeString = @"SomeString";
因此,在多个.m文件中导入Constants.h会导致重复的符号
<强>解决方案:强>
<强> Constants.h 强>
extern NSString * const kSomeString;
<强> Constants.m 强>
NSString *const kSomeString = @"SomeString";
答案 5 :(得分:1)
在您的Xcode 9项目中,您将看到左侧3列搜索图标,然后搜索: -ObjC 在搜索栏中,然后您将看到一个pod配置文件打开。 现在从继承中删除-ObjC将解决问题。
答案 6 :(得分:0)
我不想更改任何这些设置,因为没有人真正知道这些可能产生的其他副作用。所以我在全局搜索该变量名称,将导致一个类冲突的名称替换为variable_Classname。
这为我解决了这个问题而没有改变任何设置
答案 7 :(得分:0)
从错误信息中,它必须是项目中的某些文件重复。 如FilterAlertView,UserNotificationsViewController,SearchView,ExpressSliderCell ......等。您可以在错误信息中看到这一点。
答案 8 :(得分:0)
解决方案在this帖子中。你现在还不是最新的,但至少它现在解决了这个问题,至少在我的情况下我对这个版本没有任何问题。
答案 9 :(得分:0)
这些是我为解决此问题而采取的步骤: