Errors building & emulating iOS with Ionic 2 App - ios

I can't seem to be able to build or emulate in iOS. Xcode is up to date.
This is what I've tried so far:
reinstalling npm
ionic hooks add
sudo remove ios
sudo add ios (got errors when trying to emulate and build)
sudo remove ios
Adding ios without sudo (still errors trying to emulate and build)
npm install -g ios-sim
chown -R username .config/, files belong to me or root
It says iOS platform isn't installed when it definetly is.
I also don't understand how to unlink '/Users/sh/Desktop/PT/www/build/app.html'?
The screenshot below is for emulate but I get the exact same errors for build as well.

This fixed EACCES error:
sudo chown -R username /Users/username/desktop/folder
This allowed it to build and emulate correctly by installing again:
sudo npm install -g cordova
However it is not coming up correctly in the emulator but that wasn't the scope of this particular question. The emulator does launch from the command line now.

Related

Ionic app in Release mode shows white screen

When I try to run my Ionic 4 app in release mode (both in Simulator and a local iOS device) the splash screen comes up and then all I get is a white screen.
For example, when I execute this command:
ionic cordova run ios --release --prod -- --verbose
I also tried a brand new 'myApp' project (https://ionicframework.com/docs/installation/cli) and exactly the same thing happens. There is no error even when I add verbose and consolelogs.
In debug mode, a local server is started and that renders the app. How is it supposed to work in release mode?
Update: I installed the browser platform since I can't inspect an iOS device in Chrome and I see this error in the browser console which I'll now investigate:
Error: Cannot find module '#angular/core'
The main issue was that I somehow referenced some things from 'ionic-angular' instead of '#ionic/angular'. I don't know how that happened or why it didn't cause issues in Debug mode.
There was also a node-sass issue that I had to resolve first. Once I did that, I got some helpful errors running npm test.
rm -rf node_modules
sudo rm -rf /tmp/*
rm -rf /root/.npm/node-sass
npm uninstall --save node-sass
npm cache clean --force
npm install

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

Cant build Cordova ios. Error 65

My steps to make app:
I installed node js
I installed cordova: sudo npm install -g cordova
Then: npm install -g ios-sim
npm install -g ios-deploy
Also I downloaded simulator
Now I should be able to make project so:
cordova create hello com.example.hello HelloWorld
cd hello
cordova platform add ios --save
cordova build
With "cordova build" this error appears:
The following build commands failed:
CompileXIB HelloWorld/Classes/MainViewController.xib
(1 failure)
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/xXx/Desktop/Radko/hello/platforms/ios/cordova/build-debug.xcconfig,-project,HelloWorld.xcodeproj,ARCHS=i386,-target,HelloWorld,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/xXx/Desktop/Radko/hello/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/xXx/Desktop/Radko/hello/platforms/ios/build/sharedpch
Working on it for two days and no difference.
As mentioned by Radolnko
Run (This will remove the old cardova ios platform)
sudo cordova platform rm ios
Then (This will install a new platform with privileges)
sudo cordova platform add ios
Then
cordova build
This fixed it for me!
For me it was unchecking my app at Target Membership section in the .xib file itself.
Open the .xib file with xcode and in the right section at the bottom under Target Membership you will see a checkbox with your app's name.
Uncheck it!!!

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.

Resources