Ionic error when trying to add ios to project - ios

When trying to add ios to my project by running:
ionic platform add ios
in the root of my project directory, I get the following error:
Deans-Air:myApp dean$ ionic platform add ios Creating ios project...
xcrun: error: active developer path
("/Applications/Xcode6-Beta.app/Contents/Developer") does not exist,
use xcode-select --switch path/to/Xcode.app to specify the Xcode
that you wish to use for command line developer tools (or see man
xcode-select) Cordova can only run in Xcode version 4.6 or greater.
Error:
/Users/dean/.cordova/lib/npm_cache/cordova-ios/3.6.3/package/bin/create:
Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:135:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:753:16)
at Process.ChildProcess._handle.onexit (child_process.js:820:5)
This is the first time I'm trying to create an ionic application. Any help would greatly be appreciated!

You probably updated the Beta of Xcode by downloading it from the Apple developer site after installing from the App Store. The fix is in the error message, but you have to update the Xcode system path to the current Xcode version. I installed Xcode-Beta recently and had to do the same thing by navigating to my Applications folder and seeing what the exact name of the Xcode app was, then running the command with the updated path.
xcode-select --switch /Applications/Xcode-Beta.app

Related

Ionic Build iOS - Fail

I've been workign on this project for months now with no major issues. Today I can't even get it to build out. I ran "$ionic resources" and now I can't get my build to work at all.
I'm getting this error:
** BUILD FAILED **
The following build commands failed:
CompileAssetCatalog build/emulator/Stopper.app Stopper/Images.xcassets
(1 failure)
ERROR building one of the platforms: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/colemanjeff/GitHub/StopperRC1/platforms/ios/cordova/build-debug.xcconfig,-project,Stopper.xcodeproj,ARCHS=i386,-target,Stopper,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/colemanjeff/GitHub/StopperRC1/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/colemanjeff/GitHub/StopperRC1/platforms/ios/build/sharedpch
You may not have the required environment or OS to build this project
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/colemanjeff/GitHub/StopperRC1/platforms/ios/cordova/build-debug.xcconfig,-project,Stopper.xcodeproj,ARCHS=i386,-target,Stopper,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/colemanjeff/GitHub/StopperRC1/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/colemanjeff/GitHub/StopperRC1/platforms/ios/build/sharedpch
I'm not sure what caused the problem or how to fix it. Anyone have any idea?
Turns out I actually did need to uninstall the platform, remove the plugin json file, and then reinstall everything.
Run (this will remove the old ionic ios platform)
sudo ionic platform rm ios
Then (this will install a new platform with privileges)
sudo ionic platform add ios
Then build your code ios/android
ionic build ios
ionic build android
This fixed it for me!
Might be that you should also run
sudo ionic resources
to generate new icon and splash screens.
Basically, re-installation of Platform and Plugins once again resolves the issue.

Ionic ios app Build failed MainController.xib

Sometimes when i try to build my ios project on xcode i get the following error
The following build commands failed:
CompileXIB ProjectName/Classes/MainViewController.xib
Error code 65 for command: xcodebuild with args: -xcconfig,/Users/ritesh/Documents/Projects/test-app/platforms/ios/cordova/build-debug.xcconfig,-project,ProjectName.xcodeproj,ARCHS=i386,-target,ProjectName,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/ritesh/Documents/Projects/test-app/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/ritesh/Documents/Projects/test-app/platforms/ios/build/sharedpch
ERROR building one of the platforms: Error: /Users/ritesh/Documents/Projects/test-app/platforms/ios/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /Users/ritesh/Documents/Projects/test-app/platforms/ios/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:139:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
I read this bolog post and while his suggestion makes sense but I dont have a duplicate of the file which he said i should see when i open my .pbxproj file.
https://medium.com/#_qzapaia/cordova-ionic-ios-build-error-697a7ec5b46#.snruarnmz
if i build my project for the second time, it builds properly so im not sure what is causing this occasionally. Any clues from anyone?
Cheers
Run (this will remove the old ionic ios platform)
sudo ionic platform rm ios
Then (this will install a new platform with privileges)
sudo ionic platform add ios
Then build your code ios/android
ionic build ios
ionic build android
This fixed it for me!
I was having this same problem for like three days, and I just solved it for myself. My issue was that I was using Xcode 7.1, and apparently there's something about that version that was causing the compiler issue.
Solution:
I uninstalled Xcode 7.1 by deleting the app from my Applications folder.
I went to this page and downloaded Xcode 6.4 instead.
After downgrading to Xcode 6.4, I was able to build for ios without an issue.

Development Platform using PhoneGap on a Mac Pro

I am setting up a development platform using my Mac Pro. I have installed GIT, NODEJS, PhoneGap and Cordova. I have cloned a repository to my computer successfully and added the IOS platform. But when I go to build my project I get an error:
Command failed with exit code 2.
Is there something else I need to install?
here is my error:
bash-3.2# sudo -s
bash-3.2# phonegap build ios
[phonegap] executing
'cordova build ios'... Running command:
/Users/developer/PhoneBook/DOR_Phonebook_mobile/DorPhonebook/platforms/ios/cordova/build
xcode-select: error: tool 'xcodebuild' requires Xcode, but active
developer directory '/Library/Developer/CommandLineTools' is a command
line tools instance
ERROR building one of the platforms: Error:
/Users/developer/PhoneBook/DOR_Phonebook_mobile/DorPhonebook/platforms/ios/cordova/build:
Command failed with exit code 2 You may not have the required
environment or OS to build this project
Error:
/Users/developer/PhoneBook/DOR_Phonebook_mobile/DorPhonebook/platforms/ios/cordova/build:
Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/phonegap/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
at ChildProcess.emit (events.js:110:17)
at maybeClose (child_process.js:1015:16)
at Process.ChildProcess._handle.onexit (child_process.js:1087:5)
First off all, you don't need Cordova and PhoneGap because you just install the same thing with another name.
After you choosed the name which sounds better for you, you should solve your XCode Problem. There is already a question here on Stackoverflow -> Unable to use xcode-commandlinetools.
As i can see it over there, i first would recommend you to check whether you have installed the latest version of xcode and node. If you already have the latest version, try to re-install Xcode or try to run
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
After you did all like i said try to create a project again.

ENOENT error when trying to emulate Ionic made iOS app

I am trying the Ionic framework.Everything ran smoothly but
when I tried to emulate an iOS app
macbook$ sudo ionic emulate ios
I got the following error:
Password:
....
** BUILD SUCCEEDED **
No target specified for emulator. Deploying to iPhone-6 simulator
ENOENT, no such file or directory '/Users/macbook/Library/Logs/CoreSimulator/9F89ED64-0748-4A65-92DF-611110E9D4C4/system.log'
Error code 1 for command: ios-sim with args: launch,/Users/macbook/Documents/workspaceionic/MyTestApp/platforms/ios/build/emulator/MyTestApp.app,--devicetypeid,com.apple.CoreSimulator.SimDeviceType.iPhone-6,--stderr,/Users/macbook/Documents/workspaceionic/MyTestApp/platforms/ios/cordova/console.log,--stdout,/Users/macbook/Documents/workspaceionic/MyTestApp/platforms/ios/cordova/console.log,--exit
Error: /Users/macbook/Documents/workspaceionic/MyTestApp/platforms/ios/cordova/run: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Process.ChildProcess._handle.onexit (child_process.js:802:5)
do you have any ideas about what could be wrong?
I'm using Yosemite and Node version is 0.12.7. iOS apps from XCode emulate fine
EDIT:
if I open the project with XCode and emulate it, it works.
no need for sudo
ionic emulate iOS
is the correct statement
There are apparently issues with running Node 0.12.x and Ionic. I'm running into this issue, myself, in my c9.io account... the dev environ wants 0.12.x, but Ionic requires 0.10.x. See Anil Singh's response in this thread for more information: With Node 0.12.2 and npm 2.7.4 ionic installation error on windows 7
It's a permission issue, it's resolve my problem,
sudo chown -R $(whoami) ~/Code/ionic-app/

PhoneGap CLI "cordova build ios" failed

i have created a new hello world project using the following command,
cordova create hello com.example.hello HelloWorld
the project is created successfully, then i add the ios platform by
cordova platform add ios
and to verify i have it added correctly, i type
cordova platform list
the iOS platform is shown in the list. so at this point, according to the PhoneGap tutorial, i can use the command
cordova build ios
to build the iOS version of the project. however, i encounter the following error:
Generating config.xml from defaults for platform "ios"
Preparing ios project
Compiling app on platform "ios" via command "/Users/Aldour/PhoneGap/hello/platforms/ios/cordova/build"
/usr/local/lib/node_modules/cordova/node_modules/q/q.js:126
throw e;
^
Error: An error occurred while building the ios project.
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/cordova/src/compile.js:65:22)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
the results that i have googled are mostly concerning the android version, talking about the invalid environment path setting. i dont know if it is related since i can create and build a PhoneGap project targeting the android platform without problem.
here is my $PATH:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/bin/node:/usr/local/bin/npm:/Developer/SDKs/android-sdk-macosx/platform-tools:/Developer/SDKs/android-sdk-macosx/tools
EDIT:
problem solved by re-installing xcode from app store
I had the same problem in Android platform, and it was solved with the commands:
cordova platform rm android
cordova platform add android
cordova build android
in Node.Js console. try it in ios.
If you get an error with 'cordova platform add android', you may need to manually remove any android folders in your project folder hierarchy.
This resolved my issue:
cordova platform remove ios
cordova platform add ios
cordova build ios
If you run the build with --verbose, you will probably see some permission issues. By default, XCode creates a folder of the build in ~/Developer, if you haven't changed it. There probably is a permissions issue when creating that folder. Just execute the following command: sudo cordova bulid ios
That should fix your issue.

Resources