我已经按照这个条形码扫描器教程http://rdcworld-iphone.blogspot.com.au/2013/03/how-to-use-barcode-scanner-br-and-qr-in.html在模拟器中运行良好。然而,当我连接我的iPhone并尝试构建它时,它会说“构建失败”。没有错误。如果有帮助,我的手机版本是7.1.2。
我应该遵循哪个流程来找出失败的原因是什么?
编辑:
我没有在项目名称中使用_或空格。
编辑:
iPhone的错误日志:
ld: file is universal (3 slices) but does not contain a(n) armv7s slice: /Users/airefrig/Documents/BarcodeScannerDemo/BarcodeScannerDemo/ZBarSDK/libzbar.a file '/Users/airefrig/Documents/BarcodeScannerDemo/BarcodeScannerDemo/ZBarSDK/libzbar.a' for architecture armv7s
clang: error: linker command failed with exit code 1 (use -v to see invocation)
iPhone 4 64位模拟器的错误日志:
ld: warning: ignoring file /Users/airefrig/Documents/BarcodeScannerDemo/BarcodeScannerDemo/ZBarSDK/libzbar.a, missing required architecture x86_64 in file /Users/airefrig/Documents/BarcodeScannerDemo/BarcodeScannerDemo/ZBarSDK/libzbar.a (3 slices)
Undefined symbols for architecture x86_64:
"_OBJC_CLASS_$_ZBarReaderViewController", referenced from:
objc-class-ref in ViewController.o
"_ZBarReaderControllerResults", referenced from:
-[ViewController imagePickerController:didFinishPickingMediaWithInfo:] in ViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(null): Ignoring file /Users/airefrig/Documents/BarcodeScannerDemo/BarcodeScannerDemo/ZBarSDK/libzbar.a, missing required architecture x86_64 in file /Users/airefrig/Documents/BarcodeScannerDemo/BarcodeScannerDemo/ZBarSDK/libzbar.a (3 slices)
(null): "_OBJC_CLASS_$_ZBarReaderViewController", referenced from:
(null): Objc-class-ref in ViewController.o
(null): "_ZBarReaderControllerResults", referenced from:
(null): -[ViewController imagePickerController:didFinishPickingMediaWithInfo:] in ViewController.o
(null): Symbol(s) not found for architecture x86_64
(null): Linker command failed with exit code 1 (use -v to see invocation)
编辑: 通过下载和使用最新的zbar sdk框架,我可以在iPhone上正常工作。然而,现在模拟器没有像旧的那样构建!
任何人都知道如何让手机和模拟器都满意吗?
编辑2:
我让它工作使用旧库,但不是最新的,这是我必须做的工作。对于旧库,我做了以下内容:
1)创建一个新应用并使其具有通用性。 2)遵循正常的教程步骤,除了使用故事板而不是xib文件并将项目设置为使用iphone和ipad。也不要在tute末尾附近放入代码,指定使用哪个Xib,因为我没有使用它! 3)在构建设置中,将架构和有效架构设置为“armv7” 4)在构建设置中,将Build Active架构设置为YES
我最近刚刚做的是删除旧的ZBar库并替换它们http://www.nerdvision.net/app-development/ios/zbar-sdk
但它给了我这个错误:
ld: warning: ignoring file /blahblah/BarcodeScannerNew/BarcodeScannerNew/zbar_iOS7_Fix/libzbar.a, missing required architecture i386 in file /blahblah/BarcodeScannerNew/BarcodeScannerNew/zbar_iOS7_Fix/libzbar.a (3 slices)
Undefined symbols for architecture i386:
"_OBJC_CLASS_$_ZBarReaderViewController", referenced from:
objc-class-ref in AACsViewController.o
"_ZBarReaderControllerResults", referenced from:
-[AACsViewController imagePickerController:didFinishPickingMediaWithInfo:] in AACsViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我认为这意味着它需要旧的(我假设32位)库,而不是最新的库。不知道如何解决它,因为我不能包括旧的和新的Zbar文件,因为它给出了关于重复文件的错误。