出现错误的情形
像这样的一大堆,总体说编译链接时错误
/Users/JasonSu/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator/ClothingOrders.app/ClothingOrders normal i386
cd /Users/JasonSu/Desktop/SVN
setenv IPHONEOS_DEPLOYMENT_TARGET 10.1
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.1.sdk -L/Users/JasonSu/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator -L/Users/JasonSu/Desktop/SVN/ZBarSDK -F/Users/JasonSu/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator -filelist /Users/JasonSu/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Intermediates/ClothingOrders.build/Debug-iphonesimulator/ClothingOrders.build/Objects-normal/i386/ClothingOrders.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=6.1 -lz -framework MobileCoreServices -framework SystemConfiguration -framework CFNetwork -framework CoreData -liconv -framework QuartzCore -framework CoreVideo -framework CoreMedia -framework AVFoundation -framework UIKit -framework Foundation -framework CoreGraphics -lzbar -o /Users/JasonSu/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Products/Debug-iphonesimulator/ClothingOrders.app/ClothingOrders
duplicate symbol _OBJC_METACLASS_$_EntityOrdersTotal in:
/Users/JasonSu/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Intermediates/ClothingOrders.build/Debug-iphonesimulator/ClothingOrders.build/Objects-normal/i386/EntityOrdersTotal-1502FC93349A1D59.o
duplicate symbol _OBJC_CLASS_$_EntityOrdersTotal in:
/Users/JasonSu/Library/Developer/Xcode/DerivedData/ClothingOrders-bcmqkcjsfgyibbgetgiyczzqcerj/Build/Intermediates/ClothingOrders.build/Debug-iphonesimulator/ClothingOrders.build/Objects-normal/i386/EntityOrdersTotal-1502FC93349A1D59.o
ld: 2 duplicate symbols for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
原因
iOS开发这个错误一定少不了,现总结如下,一般是这几个的问题,如果不是哪你真可麻烦了
1.引用头文件出错,把***.h弄成了.m,检查一下你的所有引用;
2.再就是你引用第三方的库,你添加文件是系统没有所第三方库的.m文件参入的编译中去,你向项目添加文件得注意了,没有的要自己添加上;
3.就是不小心添加的重复的类,向Entity之类,具体你可以看这里http://stackoverflow.com/questions/2264455/iphone-duplicate-symbol-error,顺便说一下http://stackoverflow.com/这个网站是iOS开发不可少的一个网站;
4.有些frameworks没有添加进来也会出现上面的问题;
5.这个可能原因而已,比较坑爹,就是你建的类类名极为相似,Xcode识别错误,删掉相似的类重新建或者重命名吧;
6.当第三方文件丢失时,再次拷贝到工程中,有可能造成 .m文件的重复引用,也会出现这类错误。
7.引用了别的类没有在头文件.h声明的方法或变量,比如引用了没有带关键字extern 的静态变量。
如果发现还有更多的错误原因,欢迎留言~
原文参考:查看参考文