Default project screen with Cordova on iOS - ios

I have built a project written in Cordova/PhoneGap for iOS and I can only see default screen with Cordova logo. What do I have to set in XCode to copy files in www directory to cordova project stub?

Related

Build iOS app from Cordova Command Line

When building and uploading a iOS app our approach is like this.
Create the mobile app and put the Cordova configuration
run cordova platform add ios then basically load the generated folder / project into XCode
Configure and select the Signing on XCode
Use XCode to build the iOS app and upload the Archive to TestFlight
In what way all these can be done with the Cordova command-line?

Xcode does not include changes in rebuild of cordova app

I am experiencing the problem that Xcode does not incorporate any changes made to HTML/CSS/JS files when rebuilding the app for iOS
Right now I am deleting the whole platforms/ios folder and rerunning cordova add platform ios every time. This can't be the intended way of testing cordova apps. What is a good workflow for testing cordova apps on an iOS device?
Well, the recommended workflow for testing Cordova apps is not using Xcode at all, just use the Cordova CLI to run your apps. But the truth is that running from the CLI might be slower than using Xcode.
What you need to copy the changes from www to the Xcode project is to run cordova prepare ios before running from Xcode. You can do it manually or create a Xcode build script to run it for you.
To add a build script, on Xcode select your project target, go to Build Phases, click the + button and select New Build Script phase.
You can try to just add cordova prepare ios and this might work.
If you get a cordova command not found, then you also need to add Cordova path to your PATH. To do it, open a terminal and type which cordova, you'll get the Cordova path, something like /Users/davidnathan/.nvm/versions/node/v4.4.7/bin/cordova.
Now add that path without the cordova part to your build script before the cordova prepare ios, something like
PATH=/Users/davidnathan/.nvm/versions/node/v4.4.7/bin/:$PATH && cordova prepare ios
Move the build script to be over the existing "Copy www directory"
Try ionic cordova prepare ios.

Cordova 5 not handling new ios application target in XCode

I just upgraded to Cordova 5. Any XCode project that has more than one application target causes an error on build.
cordova build ios
could not find -Info.plist file, or config.xml file.
Steps to recreate:
Create a new Cordova project
Add iOS as a platform
In the XCode project, duplicate the application target to create a new target
Run "cordova build ios"
Currently using XCode 6.3.2 and Cordova 5.1.1
There is a pull request with a fix: https://github.com/apache/cordova-lib/pull/219
Until Cordova team fix it, look here:
Second answer

How to edit a Phonegap/Cordova-project in XCode?

I built a Phonegap/Cordova iOS-app using the command line. I can run it with the CLI.
After that I'm using XCode to compile and run the project that was created in 'platforms/ios' on the iOS simulator. This works too.
Now I would like to use XCode to make changes to the app. XCode does display a www-folder and config.xml but these are the top ones in the project folder , not in platforms/ios.
So if I change the files that are displayed in XCode, no changes appear when I run the project.
So, how can you edit a files of a Phonegap/Cordova project and run it with XCode ? (and still being able to use the CLI, would be nice as well).
You always need to modify the project_folder/www files. You can edit this files using Xcode, notepad++ or even with a simple notepad. Use what ever you like.
Then run the command using CLI
cordova build ios
Your project is now completely built. You can see the changes you made inside platform/ios/.../www files too. Now you can run the project using CLI or Xcode as wish. To run in CLI
cordova run ios
Or to emulate in emulator
cordova emulate ios
You are doing it right, you have to edit the root www folder.
Your problem is you have to do a cordova prepare ios to copy the changes from the root www folder to the platform/ios/www folder
You can do it from the cordova CLI or you can add a build script to you project (on build phases -> new Run Script phase) that runs the cordova prepare ios every time you run the project from xcode
The code you need on the scrip is
PATH=${PATH}:/usr/local/lib/node_modules/cordova/bin/:/usr/local/bin
cordova prepare ios
Put it the first one
If you really want to edit the patform/ios/www folder, on xcode you will see a staging folder, there you have the www folder and the changes you do there are applied to the project, but when you do a cordova prepare ios that files will be replaced by the ones on the root www folder and you will lose all your work, so don't do that

PhoneGap icons not automatically set on command line build for iOS

I'm working on a PhoneGap project and testing a lot with the online build tool. Now i try to build the project from the command line with the following command:
phonegap build ios
My project is setup for PhoneGap 2.9.0 and in the online build tool everything works fine. But when i try to generate a iOS project with the command line tools, the icons are not setup correctly.
PhoneGap creates the iOS project with a standard Resources folder with default icons and splash screens. In my PhoneGap project i also have icons and splash screens with a reference from the config.xml. The iOS project does take some of the icon references i created but some of them it uses the default icons from the resources folder...
Has someone else has this problem with the command line build?

Resources