Cordova - console.log file does not exist when using iOS Simulator - ios

When I run cordova run ios --emulator the script exits successfully and tells me, that there's a file (console.log) inside platforms/ios/cordova but there's no such file although I used console.log several times in my code.
Also, Safari does not show my device in the developer menu when it's connected via USB and running the app. I used cordova run ios --device to run the app.
Am I looking in the wrong place? Does the script lie? :D

Related

Xcode running iOS app without updated code. Ionic live reload not working

ionic cordova emulate ios -l <target>
Does not work for me. I get an error suggesting that I am targeting the wrong device even though the device I am targeting is listed as a virtual device when running the command:
ionic cordova emulate --list
When I run the app with Xcode instead it works however it does not reload my edits, even if I stop and start the app again.
*** disclaimer: this is both a quick and dirty solution to the aforementioned issues ***
Before running your app in Xcode (pressing the play button), in your project directory run the following command:
ionic cordova prepare ios
This will load your changes and update your app in Xcode before running it in your emulator so you can then debug and see your edits.
Open to suggestions if anyone has a more direct solution!
Try:
cleaning the build folder in Xcode: cmd+shift+k
In the "Device" menu of Simulator, click "Erase All Content and Settings"
Quit Xcode, simulator and whatever program you are running the emulate command in
Reboot the machine

ionic cordova run ios - nothing happens

I'm trying to deploy my Ionic app to an iPhone by running either of these commands:
ionic cordova run ios
ionic cordova run ios --device
The console displays the following text:
[OK] Your app has been deployed.
Did you know you can live-reload changes from your app with --livereload?
If we look at the console output everything seems to be fine, but my iPhone doesn't detect anything and the application doesn't run. I managed to get it on my phone by opening the workspace file inside the platforms/ios and running it with Xcode, but that's a pretty tedious process, and I'm sure that's not the way to go, as it doesn't support livereload.
Also, I tried to start a new project and I'm having the same issue, so I guess it's not any plugin's fault.
Thanks in advance for your answers.
When you run the app from Xcode, does Xcode give you any more error messages in its output window? This may be a signing issue.
same error here from console.
with --verbose
get this message
registerShutdownFunction.process.exit/normal shutdown

Targeting a particular device in the iOS simulator using Meteor

I'm currently developing a mobile app using Meteor v1.0 and trying to test iOS devices using the iOS Simulator.
For Cordova apps, I'm used to doing something like:
cordova emulate ios --target "iPad"
For Meteor, the alternative is:
meteor run ios
On my Mac, running the above Meteor command leads to the app being run on an iPhone 4S emulator. I'm unable to choose what device to emulate like I could when using Cordova.
I've tried switching device through the iOS Simulator after the app gets loaded initially but the app is not available on the device I switch to.
The only solution I have found is to navigate to the Cordova directory (.meteor/local/cordova-build) and run the iOS Simulator directly from Cordova.
Does anyone know a better solution by using Meteor itself or is this not currently possible? I haven't been able to find anything in the documentation. I'm open to testing it using something else but it would be nice to keep everything together with Meteor.
The current solution is to open Xcode by running meteor run ios-device and then select the correct simulator inside Xcode. Unfortunately, ios-sim (the package Meteor uses for the simulator) doesn't make it easy to select the device to simulate.
meteor run ios-device -p 3000 is what I do. Then download the phone gap app for iPad and run it on your IP:
ipconfig getifaddr en0
Then put that in on the phone gap app. So example: 192.168.0.8:3000

How to install cordova(phonegap) ios app to device via cli and not via xcode

I am trying to create a simple project with last phonegap version:
$ phonegap create my-project
$ phonegap build ios
$ phonegap install ios
All works perfectly and I see emulator with my simple application.
But I can't find documentation on how to run my application on device(iphone, for example) and not on a simulator.
All documentation by cordova / phonegap based on examples with cordova's template for xcode.
But last cordova's version don't have template for xcode and all that I need - cli, if I understand correctly?
I already registered as IOS developer and I have a valid iPhone development certificate.
When I connect my device - I can see it in xcode and I can run native application on my device.
But only via xcode.
I will be grateful to any advice.
If the cordova app builds and runs on the simulator, try running cordova run ios --device
This worked for me, when before it was only hitting the simulator.
Alternatively, if that STILL doesn't work for you, when you run codova build ios, to just build the app, you could use itunes to sync the generated .app file in <project_folder>/platforms/ios/build/device/AppName.app
There is an Apple CLI tool canned xcodebuild, as well as this wrapper around it by Facebook. I'd suggest trying out either that or look at the build-in xcodebuild shipped with xcode.
Hopefully one of them will work.
https://github.com/facebook/xctool
https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcodebuild.1.html
If you use Cordova CLI, you should be able to do this:
cordova run ios

iOS emulator no longer running from command line using phonegap

My iOS emulator is no longer opening when I run "phonegap run ios" in the terminal on Mac OS X. I receive no error messages and:
[phonegap] Platform "ios" deployed to emulator.
[phonegap] successfully installed onto emulator
While this is currently a known bug, you can run the emulate command more directly (note you need to build separately):
phonegap local build ios
/platforms/ios/cordova/emulate
You can also run the application using the same technique:
phonegap local build ios
/platforms/ios/cordova/run
NOTE: When using this method to run the app on your phone, the task might get stuck on the splash screen. To fix this, launch the Activity Monitor on your Mac and quit any processes with the name "ios-deploy". From there you can launch the application on your phone by clicking the application icon.
Or, you can even look inside the generated /platforms/ios folder and launch XCode project directly to test in an emulator or on your device. Open project and click the RUN button.
IMPORTANT: with all of the above methods, you MUST run the build command before running:
phonegap local build ios
Not really an answer, but I can say this is a known bug. Here is the bug so you can track it:
https://issues.apache.org/jira/browse/CB-5103
I only had this problem after upgrading to 3.1. I downgraded to 3.0 and it works more reliably:
npm uninstall -g phonegap
npm install -g phonegap#3.0
Also had to delete the platform/ios dir and plugins/ios.json and then run 'phonegap build ios' and 'phonegap run ios'

Resources