我在iPhone上为Phonegap集成barcodescanner-plugin时遇到了一些麻烦。我从这个github存储库中获取了我的插件:
https://github.com/phonegap/phonegap-plugins/
我按照说明中的所有步骤操作,包括将所有相关源添加到项目的构建路径的步骤。我也关闭了自动引用计数。我认为每个文件都在正确的位置,但无论如何我遇到了这个错误:
Undefined symbols for architecture armv7:
"_OBJC_CLASS_$_ALAssetsLibrary", referenced from:
objc-class-ref in CDVBarcodeScanner.o
"_CVPixelBufferGetBytesPerRow", referenced from:
-[CDVbcsProcessor getLuminanceSourceFromSample:imageBytes:] in CDVBarcodeScanner.o
-[CDVbcsProcessor getImageFromSample:] in CDVBarcodeScanner.o
"_CVPixelBufferUnlockBaseAddress", referenced from:
-[CDVbcsProcessor getLuminanceSourceFromSample:imageBytes:] in CDVBarcodeScanner.o
-[CDVbcsProcessor getImageFromSample:] in CDVBarcodeScanner.o
"_CVPixelBufferGetHeight", referenced from:
-[CDVbcsProcessor getLuminanceSourceFromSample:imageBytes:] in CDVBarcodeScanner.o
-[CDVbcsProcessor getImageFromSample:] in CDVBarcodeScanner.o
"_kCVPixelBufferPixelFormatTypeKey", referenced from:
-[CDVbcsProcessor setUpCaptureSession] in CDVBarcodeScanner.o
"_CVPixelBufferGetBaseAddress", referenced from:
-[CDVbcsProcessor getLuminanceSourceFromSample:imageBytes:] in CDVBarcodeScanner.o
-[CDVbcsProcessor getImageFromSample:] in CDVBarcodeScanner.o
"_CVPixelBufferLockBaseAddress", referenced from:
-[CDVbcsProcessor getLuminanceSourceFromSample:imageBytes:] in CDVBarcodeScanner.o
-[CDVbcsProcessor getImageFromSample:] in CDVBarcodeScanner.o
"_CVPixelBufferGetWidth", referenced from:
-[CDVbcsProcessor getLuminanceSourceFromSample:imageBytes:] in CDVBarcodeScanner.o
-[CDVbcsProcessor getImageFromSample:] in CDVBarcodeScanner.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
当我尝试插件的测试项目时,我会将其部署到iphone,但是当我按下“scan”时,我收到一个错误,即cordova-1.7.0.js文件丢失了。我在xCode上安装了xcode 4和cordova 1.7.0。在网络上我找不到解决方案或类似的问题。
有什么想法吗?
答案 0 :(得分:8)
将以下库添加到Xcode项目中:
AVFoundation.framework
AssetsLibrary.framework
<强> CoreVideo.framework 强>
<强> libiconv.dylib 强>
选择目标,然后显示“构建阶段”。在Link Binary With Libraries下,单击添加按钮,然后选择上面的框架。
以粗体列出的库是导致此错误发生的原因。这是摘自https://github.com/phonegap/phonegap-plugins/tree/master/iOS/BarcodeScanner
的说明答案 1 :(得分:0)
我更新到xCode 4.3.3然后错误消失了。也许由于错误导致错误。插件仍然无法正常工作,但我认为这是另一个原因,并且不再与此问题相关联。
答案 2 :(得分:0)
根据https://groups.google.com/forum/?fromgroups#!topic/phonegap/D5R450L5kLI的讨论,你可能已经完成了我刚刚做的事情。在目标设置的构建阶段下,有两组Link Binary With Libraries。我正在加入较低的空洞。将所有库添加到上面的非空库中修复它。