Undefined symbols for architecture xxx
referenced from: objc-class-ref in xxx.o
类似的问题碰过几次,相当挠头的,上次碰到是删除后,再重新覆盖文件,再拖放到项目中,莫名其妙就解决了。
今天再次碰到,试了几次都不行,在stackoverflow上找到一个帖子:
http://stackoverflow.com/questions/5403575/undefined-symbols-for-architecture-armv6-updating-to-ios-4-3
里面一个提到了可能是import参杂了一些特殊字符导致,这个估计可能是一种情况,不过对于我没帮助,我的问题解答是这个:
I added a .h, .m and NIB from another project by dragging them onto my project navigator. Xcode didn't add them to the Build Phases properly.
My solution for this problem:
Go to the Target in the navigator menu
Click on the "Build Phases" tab
Add the .m file to "Compile Sources" (either drag it across, or use the + button)
Add the .xib to "Copy bundle resources"
Clean and build
很奇怪,直接拖放文件有时候会不把文件放入编译路径,这似乎是个不稳定的情况,可能是XCode的bug吧。谨记之备忘。