Problems with Getting Started with Ionic OSX - ios

I have a problem when it comes starting with ionic in Mac. I'll explain the steps I have taken and errors I found, to see if anyone can help me.
I installed node.js from this site: nodejs.org
Thereupon I executed these commands:
$ sudo npm install -g cordova ionic cordova
$ ionic start myApp tabs
$ ionic serve
And with this last order I can see the application running. but if I try to do this:
$ sudo ionic platform add ios
I get this error:
But, These are the versions of the programs I use:
cordova - 3.6.3-0.2.13
Ionic - 1.2.7 Xcode - 6.0.1 (6A317)
XAMPP - 1.8.3-3
Someone could help me solve my problem?
Thank you in advance.

The error message says the problem, "Cordova can only run in Xcode version 4.6 or greater."
You need to install Xcode and the Xcode command line tools. Download Xcode from the AppStore, and run this command in the terminal to get the command line tools.
xcode-select --install
Also do not use sudo with the ionic commands. You'll possibly cause permission issues down the road.

Related

UnhandledPromiseRejectionWarning: xcodebuild was not found

Recently I created an app in ionic and I wanted to test it in ios. So I run the command ionic cordova emulate ios . But, It is giving me following error.
(node:4200) UnhandledPromiseRejectionWarning: xcodebuild was not found. Please install version 7.0.0 or greater from App Store
I also run following commands but it still shows same error.
npm install -g ios-sim
and
npm install -g ios-deploy
Please guide me what to do.
NOTE: I am using Ubuntu 16.04
You are getting an error because you are running this command on Linux you need macOS to run this command. Hope this will help you :)

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.

You may not have the required environment or OS to run this project - Cordova - iOS

I'm working with Cordova to build my mobile app. I'm working on a Mac machine and when I try to build and run my app on iOS device, but I'm keep getting this error.
When running:
cordova build ios
output:
** BUILD SUCCEEDED **
then I run
cordova run ios
I get the error
.../ios/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project
If I try to open the project in Xcode and run it, it successfully run on the device.
I notice that before the run failed, it output the message
ios-sim was not found. Please download, build and install 'npm install -g ios-sim'
I'm guessing Cordova thinks the device isn't plugged in since the ios-sim is a simulatur plugin for cordvoa. But I may be wrong.
Any ideas?
(This question is similar to Cordova: You may not have the required environment or OS to run this project, but this question regarding iOS there that Android)
try
npm install -g ios-sim
npm install -g ios-deploy
I suggest you read iOS Platform guide for more info.

How to run project from Terminal in Ionic + iPhone?

MacBook-Pro:myApps naveenkumar$ ionic run ios
Adding in default Ionic hooks
Running command: /Users/naveenkumar/Documents/ionic_work/myApps/hooks/after_prepare/010_add_platform_class.js /Users/naveenkumar/Documents/ionic_work/myApps
add to body class: platform-ios
Running command: /Users/naveenkumar/Documents/ionic_work/myApps/hooks/after_prepare/020_remove_sass_from_platforms.js /Users/naveenkumar/Documents/ionic_work/myApps
Running command: /Users/naveenkumar/Documents/ionic_work/myApps/platforms/ios/cordova/run
Cordova needs ios-sim version 3.0.0 or greater, you have version 1.9.0
.
ERROR running one or more of the platforms: Error: /Users/naveenkumar/Documents/ionic_work/myApps/platforms/ios/cordova/run: Command failed with exit code 2
You may not have the required environment or OS to run this project
MacBook-Pro:myApps naveenkumar$
Hello,
I am trying to run my project from terminal. I am getting the above error. But when I go to given iOS directory run my project from Xcode it works fine. That means, when I run from Xcode I am able to run emulator /simulator and check my output. But when I run from terminal I am not able to run my application. Could you please tell me how I will run my application from terminal?
Thanks
This is the issue:
Cordova needs ios-sim version 3.0.0 or greater, you have version 1.9.0
Here is the solution:
npm update -g ios-sim
The issue is that you do not have ios-sim installed.
From the ionic framework website, you can see the following statement:
Note: iOS development requires Mac OS X. iOS simulator through the Ionic CLI requires the ios-sim npm package, which can be installed with the command sudo npm -g install ios-sim.
All you need is to install ios-sim by running this command:
sudo npm -g install ios-sim
simctl was not found.
Check that you have Xcode 7.x installed:
xcodebuild --versionCheck that you have Xcode 7.x selected:
xcode-select --print-path

node install cordova / ionic / Foundation/Foundation.h not found

im trying to install cordova on a osx mavericks mac and get this error:
npm install -g cordova ionic
$ ionic start myApp tabs
$ cd myApp
$ ionic platform add ios
$ ionic build ios
..../platforms/ios/CordovaLib/CordovaLib_Prefix.pch:21:13: fatal error: 'Foundation/Foundation.h' file not found
#import <Foundation/Foundation.h>
^
1 error generated.
XCode Command Line tools are up to date.
npm is up to date.
xcode version: Version 5.1.1 (5B1008)
cordova without ionic get the same error.
phonegap itself thet the same error.
any idea whats wrong?
thx
Been looking for answer to this for a couple of days and all I needed to do is to uninstall XCode (installed via AppStore). Then re-install it (will take some time coz the new XCode is 2.18GB!).
NOTE: Keep your current cordova, node, npm and ionic installs.

Resources