在Mac IOS上出现Ionic构建错误

时间:2018-12-31 10:41:04

标签: ios cordova ionic-framework ionic3

我在IOS的Ionic构建上遇到一些错误,而Mac上的“ Ionic服务”运行良好。

我正在运行以下命令:

ionic cordova build ios

,构建错误为:

In file included from /Users/mohsinjaved/Documents/GitHub/V2/app/platforms/ios/appname/Plugins/cordova-plugin-ionic-webview/IONAssetHandler.m:1:
/Users/mohsinjaved/Documents/GitHub/V2/app/platforms/ios/appname/Plugins/cordova-plugin-ionic-webview/IONAssetHandler.h:4:40: error: no type or protocol named 'WKURLSchemeHandler'
@interface IONAssetHandler : NSObject <WKURLSchemeHandler>
                                       ^
/Users/mohsinjaved/Documents/GitHub/V2/app/platforms/ios/appname/Plugins/cordova-plugin-ionic-webview/IONAssetHandler.m:10:62: error: no type or protocol named 'WKURLSchemeTask'
- (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)urlSchemeTask
                                                             ^
/Users/mohsinjaved/Documents/GitHub/V2/app/platforms/ios/appname/Plugins/cordova-plugin-ionic-webview/IONAssetHandler.m:50:76: error: no type or protocol named 'WKURLSchemeTask'
- (void)webView:(nonnull WKWebView *)webView stopURLSchemeTask:(nonnull id<WKURLSchemeTask>)urlSchemeTask  API_AVAILABLE(ios(11.0)){
                                                                           ^
/Users/mohsinjaved/Documents/GitHub/V2/app/platforms/ios/appname/Plugins/cordova-plugin-ionic-webview/IONAssetHandler.m:13:33: error: property 'request' not found on object of type '__strong id'
    NSURL * url = urlSchemeTask.request.URL;
                                ^
/Users/mohsinjaved/Documents/GitHub/V2/app/platforms/ios/appname/Plugins/cordova-plugin-ionic-webview/IONAssetHandler.m:44:20: error: no known instance method for selector 'didReceiveResponse:'
    [urlSchemeTask didReceiveResponse:response];
                   ^~~~~~~~~~~~~~~~~~
/Users/mohsinjaved/Documents/GitHub/V2/app/platforms/ios/appname/Plugins/cordova-plugin-ionic-webview/IONAssetHandler.m:45:20: error: no known instance method for selector 'didReceiveData:'
    [urlSchemeTask didReceiveData:data];
                   ^~~~~~~~~~~~~~
/Users/mohsinjaved/Documents/GitHub/V2/app/platforms/ios/appname/Plugins/cordova-plugin-ionic-webview/IONAssetHandler.m:46:20: error: no known instance method for selector 'didFinish'
    [urlSchemeTask didFinish];
                   ^~~~~~~~~
7 errors generated.

CompileC /Users/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/appname.build/Debug-iphonesimulator/appname.build/Objects-normal/x86_64/GCDWebServer.o appname/Plugins/cordova-plugin-ionic-webview/GCDWebServer.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    cd /Users/mohsinjaved/Documents/GitHub/V2/app/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/mohsinjaved/Documents/GitHub/V2/app/node_modules/.bin:/usr/local/opt/node@10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /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/mohsinjaved/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/Users/mohsinjaved/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/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/appname.build/Debug-iphonesimulator/appname.build/appname-generated-files.hmap -I/Users/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/appname.build/Debug-iphonesimulator/appname.build/appname-own-target-headers.hmap -I/Users/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/appname.build/Debug-iphonesimulator/appname.build/appname-all-target-headers.hmap -iquote /Users/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/appname.build/Debug-iphonesimulator/appname.build/appname-project-headers.hmap -I/Users/mohsinjaved/Documents/Github/V2/app/platforms/ios/build/emulator/include -I/Users/mohsinjaved/Documents/Github/V2/app/platforms/ios/build/emulator/usr/local/lib/include -I/Users/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/UninstalledProducts/include -I/Users/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/UninstalledProducts/iphonesimulator/include -I/Users/mohsinjaved/Documents/Github/V2/app/platforms/ios/build/emulator -I/Users/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/appname.build/Debug-iphonesimulator/appname.build/DerivedSources/x86_64 -I/Users/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/appname.build/Debug-iphonesimulator/appname.build/DerivedSources -F/Users/mohsinjaved/Documents/Github/V2/app/platforms/ios/build/emulator -include /Users/mohsinjaved/Documents/Github/V2/app/platforms/ios/build/sharedpch/appname-Prefix-ejxenhctjcrayehjbwsmpoicigmk/appname-Prefix.pch -MMD -MT dependencies -MF /Users/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/appname.build/Debug-iphonesimulator/appname.build/Objects-normal/x86_64/GCDWebServer.d --serialize-diagnostics /Users/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/appname.build/Debug-iphonesimulator/appname.build/Objects-normal/x86_64/GCDWebServer.dia -c /Users/mohsinjaved/Documents/GitHub/V2/app/platforms/ios/appname/Plugins/cordova-plugin-ionic-webview/GCDWebServer.m -o /Users/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/appname.build/Debug-iphonesimulator/appname.build/Objects-normal/x86_64/GCDWebServer.o

** BUILD FAILED **


The following build commands failed:
    CompileC /Users/mohsinjaved/Library/Developer/Xcode/DerivedData/appname-dwzkhngrmwxjidcdydxjcxdaraat/Build/Intermediates/appname.build/Debug-iphonesimulator/appname.build/Objects-normal/x86_64/IONAssetHandler.o appname/Plugins/cordova-plugin-ionic-webview/IONAssetHandler.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
CordovaError: Promise rejected with non-error: 'Error code 65 for command: xcodebuild with args: -xcconfig,/Users/mohsinjaved/Documents/Github/V2/app/platforms/ios/cordova/build-debug.xcconfig,-workspace,appname.xcworkspace,-scheme,appname,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS Simulator,name=iPhone SE,build,CONFIGURATION_BUILD_DIR=/Users/mohsinjaved/Documents/Github/V2/app/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/mohsinjaved/Documents/Github/V2/app/platforms/ios/build/sharedpch'
    at cli.catch.err (/usr/local/lib/node_modules/cordova/bin/cordova:30:15)
    at process._tickCallback (internal/process/next_tick.js:68:7)
[ERROR] An error occurred while running subprocess cordova.

我的环境:

Mac OS: 10.12.0
xcode: 8.2.1
npm: 6.4.1

我是Ionic-IOS的新手,所以请指导我如何解决此问题。在我看来,这与代码无关。

1 个答案:

答案 0 :(得分:0)

我通过执行以下简单步骤解决了这个问题:

  1. 离子Cordova平台删除iOS
  2. ionic cordova平台添加ios
  3. 离子科尔多瓦建立iOS

希望它也对您有帮助。另外,请尝试使用最新版本的Xcode。