问题一:
Undefined symbols for architecture armv7:
"_CVPixelBufferLockBaseAddress", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_CVPixelBufferGetBytesPerRow", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_CMSampleBufferGetImageBuffer", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_CVPixelBufferGetWidth", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_CVPixelBufferGetBaseAddress", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_kCVPixelBufferPixelFormatTypeKey", referenced from:
-[ZXingWidgetController initCapture] in libZXingWidget.a(ZXingWidgetController.o)
"_CVPixelBufferGetHeight", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
"_CVPixelBufferUnlockBaseAddress", referenced from:
-[ZXingWidgetController captureOutput:didOutputSampleBuffer:fromConnection:] in libZXingWidget.a(ZXingWidgetController.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
解决方法:
Have you referenced all the frameworks to the project?
Make sure these frameworks are added:
a. AVFoundation <- This is probably the one which is causing the prob for you. Make sure this is added.
b. AudioToolbox
c. CoreVideo <- This is second culprit. Check if this is added
d. CoreMedia <- This is second culprit as well. Check if this is added
e. libiconv
f. AddressBook
g. AddressBookUI
问题二:
1.使用zxing的方法参考文档http://blog.csdn.net/icash/article/details/7727299。
2.如果你项目中使用了zxing,但是在xcdoe升级到4.5以后出现Incompatible pointer types sending 'Class' (aka 'Class *') to parameter of type 'id'错误,解决办法:重新下载更新版本的ZXing, 可以使用命令下载最新版本:svn checkout http://zxing.googlecode.com/svn/trunk/ zxing-read-only。
3.如果出现了问题Undefined symbols for architecture i386"std::string::c_str() const", referenced from。。。。,
将你项目中的Apple LLVM compiler 4.1 - language中的 c Language Dialect、c++ Language Dialect、c++ standard Library设置成下图所选的值。参考http://stackoverflow.com/questions/12665457/zxing-in-xcode-4-5-and-ios-6
4.编译成功往真机上装的时候出现Choose a destination with a supported architecture in order to run on this device ,由于ios设备不支持armv7s,所以必须将Architectures设置为armv6,但是仅仅需要改动valid architectures就行,不要改动architectures,否则容易引起真机不运行。把architectures改为$(ARCHS_STANDARD_32_BIT)就可以撞到手机上了。见http://blog.sina.com.cn/s/blog_90a0ad8d01013uuh.html
下载:
https://github.com/zxing/zxing/tree/master/iphone