How to run project from Terminal in Ionic + iPhone? - ios

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

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 :)

React native runnig error on ios device

I am trying to run react native code to iphone, however it shows the following message.
The following code runs on Android normally, and on expo fine too, but it does not run on physical device.
Please help me.
E:\reactnative\cd webview
E:\reactnative\webview>react-native run-ios
Scanning folders for symlinks in E:\reactnative\webview\node_modules (38ms)
Found Xcode project webview.xcodeproj
spawnSync xcrun ENOENT
E:\reactnative\webview>
If you are using react-native-cli version 0.1.7 then you could either
Rollback to 0.1.7 (do not use '--verbose' argument)
npm install -g react-native-cli#0.1.7
or try it with the latest which might be fixed
npm uninstall -g react-native-cli
npm install -g react-native-cli
There was a regression in 0.1.8, reported here: https://github.com/facebook/react-native/issues/5169

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.

Problems with Getting Started with Ionic OSX

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.

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