美文网首页
Error for iOS

Error for iOS

作者: iLeooooo | 来源:发表于2018-06-28 09:57 被阅读332次

Error 1:

[WARN]Warning: Multiple build commands for output file /Developer/xxx/xxx.xxx
or
Error: Multiple commands produce '/Users/xxx/Library/Developer/Xcode/DerivedData/xxx-azkpjshzmzhpaeaegtxmlgrewbpt/Build/Products/Debug-iphoneos/xxx.app/Info.plist':
1) Target 'xxx' has copy command from '/Users/xxx/Documents/xxx/SupportingFiles/Info.plist' to '/Users/xxx/Library/Developer/Xcode/DerivedData/xxx-azkpjshzmzhpaeaegtxmlgrewbpt/Build/Products/Debug-iphoneos/xxx.app/Info.plist'
2) Target 'xxx' has process command with input '/Users/xxx/Documents/xxx/SupportingFiles/Info.plist'

解决方法:

In the Project Navigator, select your Xcode Project file. This will show you the project settings as well as the targets in the project. Look in the "Copy Bundle Resources" Build Phase. You should find the offending files in that list twice. Delete the duplicate reference.
Xcode is complaining that you are trying to bundle the same file with your application two times. stack overflow

选中Target,选Build Phase,在Copy Bundle Resources中删除重复的文件,如果发现文件并没有重复,可以先把文件删除,clean一下,然后问题就解决了~ 后面也可以删除的文件在加回去。如果是重复文件的话就可以不用加回去了。

Error 2:

今天在使用cocoaPods的时候,发现报错了,如下:


1 2 3 4 5

解决办法:
照着后面给出的解决办法链接,就可以找到解决办法。是因为我刚刚创建的项目用的是Xcode9.4.1版本创建的,所以项目的Project Document下面的Project Format是Xcode 9.3-compatible,把这个设置改为9.3以下的就OK了~

首先选中当前项目文件

解决1 解决2

Error 3:

昨天看了一下博客,今天心血来潮想写个简单的macOS app,用Swift写,在pod一些框架的时候,首先是遇到了上面Error 2的错误,改正之后,就是下面的错误了。

 The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. This setting can be set in the build settings editor.

解决办法:Project ► (Select Your Project Target) ► Build Settings ► (Type 'swift' in Searchbar) Swift Compiler Language ► Swift Language Version ► Click on Language list to open it.

Xcode 9 Swift Language Version (SWIFT_VERSION) - Stack Overflow

Error 4:

今天该死的和同事合并代码报错
_OBJC_IVAR_$_BDConversationCell._userNameLabel in: 某路径
该错误是一种链接错误,Xcode不会直接定位到问题具体位置。

但其仍有一定的规律,大概是以下原因:
1.检查是否误导入了问题中类的 .m 文件;
报错:

duplicate symbol _OBJC_IVAR_$_TestViewController._button in: /Users/Kingdev/Library/Developer/Xcode/DerivedData/测试OC-eluxicnvoptnsgcghlsslvbpkzzm/Build/Intermediates/测试OC.build/Debug-iphonesimulator/测试OC.build/Objects-normal/x86_64/ViewController.o /Users/Kingdev/Library/Developer/Xcode/DerivedData/测试OC-eluxicnvoptnsgcghlsslvbpkzzm/Build/Intermediates/测试OC.build/Debug-iphonesimulator/测试OC.build/Objects-normal/x86_64/TestViewController.o
ld: 3 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

原因:

image
2.项目中是否存在同名的文件 [①多人协作开发导致project文件合并冲突 ②自己文件与三方中文件重名了]

报错:

ld: 3 duplicate symbols for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

原因:

image
若在项目中搜索中搜索发现,不存在同名的文件,就可判断出不是问题2。基本上就是问题3了。
3.在 TARGETS ——> Build Phases ——> Compiles Sources,看看出现问题的类是不是有重复的或路径出现了问题。多人协作开发时就容易出现这种问题,project文件冲突导致的。

解决:直接搜索出现错误的文件名,会发现有两个这个m文件,直接删除一个即可。

duplicate symbol _OBJC_IVAR

慢慢来,一步一个巴掌印~~~

持续更新。。。。

相关文章

网友评论

      本文标题:Error for iOS

      本文链接:https://www.haomeiwen.com/subject/xdawyftx.html