Ionic ios 构建因 phonegap-plugin-barcodescanner 失败
Posted
技术标签:
【中文标题】Ionic ios 构建因 phonegap-plugin-barcodescanner 失败【英文标题】:Ionic ios build fails with phonegap-plugin-barcodescanner 【发布时间】:2018-06-08 00:18:40 【问题描述】:我构建了一个可在 android 平台上运行的应用,现在我想为 ios 构建它。我收到了一个似乎不是很清楚的错误,我无法通过我最好的 Google-Fu 努力找到有关它的信息。这是我所做的:
将我的代码的最新工作版本推送到 Git 存储库 将 Git 存储库克隆到 iMac(20 英寸,2007 年中) 安装了可在此硬件上运行的最新版 OS X (El Capitan) 安装了将在 El Capitan 上运行的最新版本的 xCode (8.2.1) 确保 npm、ionic、cordova 均已安装 $ ionic cordova platform add ios(无错误) $ ionic cordova resources ios(无错误) $ ionic cordova run ios --emulator(错误;详情如下)构建失败后,我尝试删除平台和所有插件,然后再次添加/安装它们,但无济于事。失败后,我删除了该项目并从存储库中使用新的克隆重新开始,但我不知道下一步该尝试什么。
这是我的离子信息:
cli packages: (/Users/bbale/nodejs/kostiziPus/node_modules)
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
@ionic/app-scripts : 3.1.0
Cordova Platforms : ios 4.5.4
Ionic Framework : ionic-angular 3.9.2
System:
ios-deploy : 1.9.2
Node : v8.9.0
npm : 5.5.1
OS : OS X El Capitan
Xcode : Xcode 8.2.1 Build version 8C1002
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
这是构建尝试的一些输出。我无法将其全部包含在内,因为我只能将 30K 个字符放入帖子正文中。但我想我得到了相关的信息。
CompileC /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/Objects-normal/x86_64/CDVBarcodeScanner.o CWikPay/Plugins/phonegap-plugin-barcodescanner/CDVBarcodeScanner.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/bbale/nodejs/kostiziPush/platforms/ios
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/bbale/nodejs/kostiziPush/node_modules/.bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c++ -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -fobjc-arc -fmodules -gmodules -fmodules-cache-path=/Users/bbale/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/bbale/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-implicit-atomic-properties -Wno-arc-repeated-use-of-weak -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -Wno-c++11-extensions -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -Winvalid-offsetof -mios-simulator-version-min=9.0 -g -fvisibility=hidden -fvisibility-inlines-hidden -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -fobjc-abi-version=2 -fobjc-legacy-dispatch -iquote /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/CWikPay-generated-files.hmap -I/Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/CWikPay-own-target-headers.hmap -I/Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/CWikPay-all-target-headers.hmap -iquote /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/CWikPay-project-headers.hmap -I/Users/bbale/nodejs/kostiziPush/platforms/ios/build/emulator/include -I/Users/bbale/nodejs/kostiziPush/platforms/ios/build/emulator/usr/local/lib/include -I/Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/UninstalledProducts/include -I/Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/UninstalledProducts/iphonesimulator/include -I/Users/bbale/nodejs/kostiziPush/platforms/ios/build/emulator -I/Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/DerivedSources/x86_64 -I/Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/DerivedSources -F/Users/bbale/nodejs/kostiziPush/platforms/ios/build/emulator -FCWikPay/Plugins/cordova-plugin-googleplus -FCWikPay/Plugins/cordova-plugin-facebook4 -include /Users/bbale/nodejs/kostiziPush/platforms/ios/build/sharedpch/CWikPay-Prefix-flmtzfdhgtekwthaadlusksyrtrc/CWikPay-Prefix.pch -MMD -MT dependencies -MF /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/Objects-normal/x86_64/CDVBarcodeScanner.d --serialize-diagnostics /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/Objects-normal/x86_64/CDVBarcodeScanner.dia -c /Users/bbale/nodejs/kostiziPush/platforms/ios/CWikPay/Plugins/phonegap-plugin-barcodescanner/CDVBarcodeScanner.mm -o /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/Objects-normal/x86_64/CDVBarcodeScanner.o
/Users/bbale/nodejs/kostiziPush/platforms/ios/CWikPay/Plugins/phonegap-plugin-barcodescanner/CDVBarcodeScanner.mm:282:17: warning: method definition for 'captureOutput:didOutputSampleBuffer:fromConnection:' not found [-Wincomplete-implementation]
@implementation CDVbcsProcessor
^
/Users/bbale/nodejs/kostiziPush/platforms/ios/CWikPay/Plugins/phonegap-plugin-barcodescanner/CDVBarcodeScanner.mm:78:1: note: method 'captureOutput:didOutputSampleBuffer:fromConnection:' declared here
- (void)captureOutput:(AVCaptureOutput*)captureOutput didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer fromConnection:(AVCaptureConnection*)connection;
^
/Users/bbale/nodejs/kostiziPush/platforms/ios/CWikPay/Plugins/phonegap-plugin-barcodescanner/CDVBarcodeScanner.mm:1027:9: error: unexpected '@' in program
if (@available(iOS 11.0, *))
^
/Users/bbale/nodejs/kostiziPush/platforms/ios/CWikPay/Plugins/phonegap-plugin-barcodescanner/CDVBarcodeScanner.mm:1028:92: error: property 'safeAreaLayoutGuide' not found on object of type 'UIView *'
bounds = CGRectMake(bounds.origin.x, bounds.origin.y, bounds.size.width, self.view.safeAreaLayoutGuide.layoutFrame.size.height+self.view.safeAreaLayoutGuide.layoutFrame.origin.y);
^
/Users/bbale/nodejs/kostiziPush/platforms/ios/CWikPay/Plugins/phonegap-plugin-barcodescanner/CDVBarcodeScanner.mm:1028:146: error: property 'safeAreaLayoutGuide' not found on object of type 'UIView *'
bounds = CGRectMake(bounds.origin.x, bounds.origin.y, bounds.size.width, self.view.safeAreaLayoutGuide.layoutFrame.size.height+self.view.safeAreaLayoutGuide.layoutFrame.origin.y);
^
1 warning and 3 errors generated.
CompileC /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/Objects-normal/x86_64/LaunchNavigator.o CWikPay/Plugins/uk.co.workingedge.phonegap.plugin.launchnavigator/LaunchNavigator.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/bbale/nodejs/kostiziPush/platforms/ios
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/bbale/nodejs/kostiziPush/node_modules/.bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch x86_64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c99 -fobjc-arc -fmodules -gmodules -fmodules-cache-path=/Users/bbale/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/bbale/Library/Developer/Xcode/DerivedData/ModuleCache/Session.modulevalidation -fmodules-validate-once-per-build-session -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-implicit-atomic-properties -Wno-arc-repeated-use-of-weak -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wno-deprecated-implementations -DDEBUG=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -mios-simulator-version-min=9.0 -g -fvisibility=hidden -Wno-sign-conversion -Wno-infinite-recursion -fobjc-abi-version=2 -fobjc-legacy-dispatch -iquote /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/CWikPay-generated-files.hmap -I/Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/CWikPay-own-target-headers.hmap -I/Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/CWikPay-all-target-headers.hmap -iquote /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/CWikPay-project-headers.hmap -I/Users/bbale/nodejs/kostiziPush/platforms/ios/build/emulator/include -I/Users/bbale/nodejs/kostiziPush/platforms/ios/build/emulator/usr/local/lib/include -I/Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/UninstalledProducts/include -I/Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/UninstalledProducts/iphonesimulator/include -I/Users/bbale/nodejs/kostiziPush/platforms/ios/build/emulator -I/Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/DerivedSources/x86_64 -I/Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/DerivedSources -F/Users/bbale/nodejs/kostiziPush/platforms/ios/build/emulator -FCWikPay/Plugins/cordova-plugin-googleplus -FCWikPay/Plugins/cordova-plugin-facebook4 -include /Users/bbale/nodejs/kostiziPush/platforms/ios/build/sharedpch/CWikPay-Prefix-frrsmamqlpzzghgslciomghcaqkm/CWikPay-Prefix.pch -MMD -MT dependencies -MF /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/Objects-normal/x86_64/LaunchNavigator.d --serialize-diagnostics /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/Objects-normal/x86_64/LaunchNavigator.dia -c /Users/bbale/nodejs/kostiziPush/platforms/ios/CWikPay/Plugins/uk.co.workingedge.phonegap.plugin.launchnavigator/LaunchNavigator.m -o /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/Objects-normal/x86_64/LaunchNavigator.o
/Users/bbale/nodejs/kostiziPush/platforms/ios/CWikPay/Plugins/uk.co.workingedge.phonegap.plugin.launchnavigator/LaunchNavigator.m:1430:56: warning: 'CFURLCreateStringByAddingPercentEscapes' is deprecated: first deprecated in iOS 9.0 - Use [NSString stringByAddingPercentEncodingWithAllowedCharacters:] instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent (since each URL component or subcomponent has different rules for what characters are valid). [-Wdeprecated-declarations]
NSString* newString = (__bridge_transfer NSString*)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (__bridge CFStringRef)queryParam, NULL, (CFStringRef)@"!*'();:@&=+$,/?%#[]", kCFStringEncodingUTF8);
^
In module 'Foundation' imported from /Users/bbale/nodejs/kostiziPush/platforms/ios/build/emulator/include/Cordova/CDVPlugin.h:20:
In module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.2.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFURL.h:398:13: note: 'CFURLCreateStringByAddingPercentEscapes' has been explicitly marked deprecated here
CFStringRef CFURLCreateStringByAddingPercentEscapes(CFAllocatorRef allocator, CFStringRef originalString, CFStringRef charactersToLeaveUnescaped, CFStringRef legalURLCharactersToBeEscaped, CFStringEncoding encoding) CF_DEPRECATED(10_0, 10_11, 2_0, 9_0, "Use [NSString stringByAddingPercentEncodingWithAllowedCharacters:] instead, which always uses the recommended UTF-8 encoding, and which encodes for a specific URL component or subcomponent (since each URL component or subcomponent has different rules for what characters are valid).");
^
** BUILD FAILED **
The following build commands failed:
CompileC /Users/bbale/Library/Developer/Xcode/DerivedData/CWikPay-dvcxvejyqnkgeobfltsgdrhfzqwi/Build/Intermediates/CWikPay.build/Debug-iphonesimulator/CWikPay.build/Objects-normal/x86_64/CDVBarcodeScanner.o CWikPay/Plugins/phonegap-plugin-barcodescanner/CDVBarcodeScanner.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/bbale/nodejs/kostiziPush/platforms/ios/cordova/build-debug.xcconfig,-workspace,CWikPay.xcworkspace,-scheme,CWikPay,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone SE,build,CONFIGURATION_BUILD_DIR=/Users/bbale/nodejs/kostiziPush/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/bbale/nodejs/kostiziPush/platforms/ios/build/sharedpch
[ERROR] An error occurred while running cordova run ios --emulator (exit code 1).
这里有很多东西要解压,但我首先怀疑是 phonegap-plugin-barcodescanner 的 iOS 实现存在问题,或者可能是依赖问题,可以通过安装正确版本的东西来解决。
如果不从头开始构建一个全新的应用程序,我该如何解决这个问题?
【问题讨论】:
【参考方案1】:我发现 phonegap-plugin-barcodescanner 需要 xCode 9 或更高版本,它无法在 El Capitan 上运行,因此 2007 年 iMac 硬件无法成功完成构建。我现在有一个更新的 Mac Mini,带有 macOS High Sierra (10.13.5) 和最新版本的 xCode (9.4.1)。升级让我克服了这个错误。
更多详情:https://github.com/phonegap/phonegap-plugin-barcodescanner/issues/682
【讨论】:
以上是关于Ionic ios 构建因 phonegap-plugin-barcodescanner 失败的主要内容,如果未能解决你的问题,请参考以下文章
Ionic - 在 Windows 上为 IOS 构建(适用于最新的 IOS 和 Ionic)