Unable to build ios app for ionic v1

While trying to fix iPhoneX related issues, I updated Cordova to latest as per the blog and since then I’m unable to build and deploy an ios app.
What is the appropriate version of Cordova one should use with ionic v1?

1 Like

share your your error here

Basically I’m trying to find the correct combination of node and cordova that works for for ionic 1.7.16

With Cordova at 4.x I can not add platform ios

When I run command “ionic state reset” i get following error

/usr/local/lib/node_modules/ionic/node_modules/ionic-app-lib/lib/state.js:543
throw ‘Error executing "’ + pluginCommand + ‘":\n’ + output;
^
Error executing “cordova plugin add cordova-plugin-device@1.1.4”:
Fetching plugin “cordova-plugin-device@1.1.4” via plugin registry
info trying registry request attempt 1 at 10:18:06 AM
http GET http://registry.cordova.io/cordova-plugin-device/1.1.4
info retry will retry, error on last attempt: Error: connect ETIMEDOUT 50.17.177.14:80
info trying registry request attempt 2 at 10:19:32 AM
http GET http://registry.cordova.io/cordova-plugin-device/1.1.4
info retry will retry, error on last attempt: Error: connect ETIMEDOUT 50.17.177.14:80
info trying registry request attempt 3 at 10:21:47 AM
http GET http://registry.cordova.io/cordova-plugin-device/1.1.4
Error: connect ETIMEDOUT 50.17.177.14:80
at Object.exports._errnoException (util.js:1022:11)
at exports._exceptionWithHostPort (util.js:1045:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1087:14)

Here’s ionic info output

$ ionic info

Your system information:

Cordova CLI: 4.3.1
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
ios-deploy version: 1.9.2
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v6.9.5
Xcode version: Xcode 9.2 Build version 9C40b

Once I change corodova version to 6.5.0 , I dont get the message “Build Successful” but still I run “ionic build ios” and it fails to build in XCode

Here’s ionic info

$ ionic info

Your system information:

Cordova CLI: Not installed
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
ios-deploy version: 1.9.2
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v6.9.5
Xcode version: Xcode 9.2 Build version 9C40b


Dependency warning - for the CLI to run correctly,
it is highly recommended to install/upgrade the following:

Please install your Cordova CLI to version >=4.2.0 npm install -g cordova


XCode fails to build with the following error

duplicate symbol OBJC_CLASS$_CDVLogger in:
/Users/amarlungare/Library/Developer/Xcode/DerivedData/mySite-gilahgmzhtrlwcavavszvkantrhh/Build/Intermediates.noindex/mySite.build/Debug-iphoneos/mySite.build/Objects-normal/arm64/CDVLogger.o
/Users/amarlungare/Library/Developer/Xcode/DerivedData/mySite-gilahgmzhtrlwcavavszvkantrhh/Build/Products/Debug-iphoneos/libCordova.a(CDVLogger.o)
duplicate symbol OBJC_METACLASS$_CDVLogger in:
/Users/amarlungare/Library/Developer/Xcode/DerivedData/mySite-gilahgmzhtrlwcavavszvkantrhh/Build/Intermediates.noindex/mySite.build/Debug-iphoneos/mySite.build/Objects-normal/arm64/CDVLogger.o
/Users/amarlungare/Library/Developer/Xcode/DerivedData/mySite-gilahgmzhtrlwcavavszvkantrhh/Build/Products/Debug-iphoneos/libCordova.a(CDVLogger.o)
ld: 2 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

When i run “ionic build ios” it ends with the following output which I dont think is correct andI am not aware of any of the ionic internals to figure out whats causing the problem.

CompileC /var/root/Library/Developer/Xcode/DerivedData/mySite-ejvnbohfatgzmvdyufibglqguibz/Build/Intermediates.noindex/ArchiveIntermediates/mySite/IntermediateBuildFilesPath/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Objects-normal/arm64/CDVUIWebViewDelegate.o Classes/Private/Plugins/CDVUIWebViewEngine/CDVUIWebViewDelegate.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
cd /Users/amarlungare/Documents/workspace/projects/mysite-mobileApp-Interim/Sprint-20.1/code/platforms/ios/CordovaLib
export LANG=en_US.US-ASCII
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/amarlungare/.rvm/bin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -arch arm64 -fmessage-length=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit=0 -std=c99 -fobjc-arc -fmodules -fmodules-cache-path=/var/root/Library/Developer/Xcode/DerivedData/ModuleCache -fmodules-prune-interval=86400 -fmodules-prune-after=345600 -fbuild-session-file=/var/root/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 -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-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/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -miphoneos-version-min=9.0 -g -Wno-sign-conversion -Wno-infinite-recursion -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -iquote /var/root/Library/Developer/Xcode/DerivedData/mySite-ejvnbohfatgzmvdyufibglqguibz/Build/Intermediates.noindex/ArchiveIntermediates/mySite/IntermediateBuildFilesPath/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Cordova-generated-files.hmap -I/var/root/Library/Developer/Xcode/DerivedData/mySite-ejvnbohfatgzmvdyufibglqguibz/Build/Intermediates.noindex/ArchiveIntermediates/mySite/IntermediateBuildFilesPath/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Cordova-own-target-headers.hmap -I/var/root/Library/Developer/Xcode/DerivedData/mySite-ejvnbohfatgzmvdyufibglqguibz/Build/Intermediates.noindex/ArchiveIntermediates/mySite/IntermediateBuildFilesPath/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Cordova-all-target-headers.hmap -iquote /var/root/Library/Developer/Xcode/DerivedData/mySite-ejvnbohfatgzmvdyufibglqguibz/Build/Intermediates.noindex/ArchiveIntermediates/mySite/IntermediateBuildFilesPath/CordovaLib.build/Debug-iphoneos/CordovaLib.build/Cordova-project-headers.hmap -I/Users/amarlungare/Documents/workspace/projects/mysite-mobileApp-Interim/Sprint-20.1/code/platforms/ios/build/device/include -I/var/root/Library/Developer/Xcode/DerivedData/mySite-ejvnbohfatgzmvdyufibglqguibz/Build/Intermediates.noindex/ArchiveIntermediates/mySite/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/usr/local/lib/include -I/var/root/Library/Developer/Xcode/DerivedData/mySite-ejvnbohfatgzmvdyufibglqguibz/Build/Intermediates.noindex/ArchiveIntermediates/mySite/IntermediateBuildFilesPath/UninstalledProducts/include -I/var/root/Library/Developer/Xcode/DerivedData/mySite-ejvnbohfatgzmvdyufibglqguibz/Build/Intermediates.noindex/ArchiveIntermediates/mySite/IntermediateBuildFilesPath/UninstalledProducts/iphoneos/include -I/Users/amarlungare/Documents/workspace/projects/mysite-mobileApp-Interim/Sprint-20.1/code/platforms/ios/build/device -I/var/root/Library/Developer/Xcode/DerivedData/mySite-ejvnbohfatgzmvdyufibglqguibz/Build/Intermediates.noindex/ArchiveIntermediates/mySite/IntermediateBuildFilesPath/CordovaLib.build/Debug-iphoneos/CordovaLib.build/DerivAmars-iMac:code

I was able to resolve it and the problem seem to be the combination of things considering that we are using ionc@1.7.16 (I know we are way behind the world but we can not just up and go with the new ionic version for a app thats working fine)

  1. You can not use Cordova < 5.0.0 since it points to “registry.cordova.io” which is defunct now. I think it worked till few days agin before I cleared cached version of Cordova from my system and then it started looking for a downlodable version of cordova 4.x and couldnt find it at http://registry.cordova.io. This forced me to use a newer version of cordova and I ended up using v6.5.0

  2. If you are using nodejs v 6.x, you must use npm v3.x
    You can do it by running below two commands
    $ npm install -g node@6
    and
    $ npm install -g npm@3

And here’s my ionic info

$ sudo ionic info

Your system information:

Cordova CLI: 6.5.0
Gulp version: CLI version 3.9.1
Gulp local: Local version 3.9.1
Ionic CLI Version: 1.7.16
Ionic App Lib Version: 0.7.3
ios-deploy version: 1.9.2
ios-sim version: 5.0.8
OS: Mac OS X El Capitan
Node Version: v6.9.5
Xcode version: Xcode 9.2 Build version 9C40b

I hope this helps someone stuck with this peculiar problem.

Your app should work just fine with current Ionic CLI.
Same for Cordova CLI - staying with older versions can really be a problem.

But if it works for you now, of course everything is fine.