Development Platform using PhoneGap on a Mac Pro - ios

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.

Related

Ionic Emulate iOS/Android command not working

Context: I am currently on Ionic version 3.15.2. The 'ionic serve' command works. The 'ionic cordova emulate ios' and 'ionic cordova emulate android' do not work. I have tried deleting/reinstalling certain packages and dependencies from Ionic but nothing has helped. I have a feeling I need to delete/reinstall Xcode all together but I figured I would ask for help here first. This is the error message I get on my terminal when I try to use the Ionic simulator/emulator:
Command /usr/bin/codesign failed with exit code 1
** BUILD FAILED **
The following build commands failed:
CodeSign build/emulator/****app.app
(1 failure)
Error: Error code 65 for command: xcodebuild with args:
-xcconfig,/Users/*****/Desktop/*****/platforms/ios/cordova/build-debug.xcconfig,-workspace,****app.xcworkspace,-scheme,****app,-configuration,Debug,-sdk,iphonesimulator,-destination,platform=iOS
Simulator,name=iPhone
5s,build,CONFIGURATION_BUILD_DIR=/Users/*****/Desktop/****/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/****/Desktop/****/platforms/ios/build/sharedpch
[ERROR] An error occurred while running cordova emulate ios (exit code 1).
Note: I used the asterisks in place of the path for privacy reasons
It's weird that ionic serve works but the other two commands don't...
Even ionic info should fail with the latter error.
It's because of the module #ionic/cli-plugin-proxy. As soon as I uninstalled it I could successfully run ionic info. But it detected IONIC_HTTP_PROXY in my environment and asked me to install it again.
So I did manually later, but the error returned. So I installed the missing module using npm install -g #ionic/cli-framework. After that I could successfully run ionic info again.
Therefor I guess it's an unresolved dependency issue inside the #ionic/cli-plugin-proxy module.

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.

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/

Ionic error when trying to add ios to project

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

Resources