I'm about to give up on trying to build PhoneGap ready apps using Visual Studio and go the Mac route. My only hesitation is all of my WebApis for accessing server data is developed using ASP.Net MVC WebApi (C#). I really do not want to jump from Mac for developing UI to Windows for developing WebApi.
Anyways, in researching PhoneGap 3.3 and using the CLI to establish the project structure, I discovered that a shared www folder is created where all of your Html, JS, and CSS code should reside. Each platform you add to your project (iOS, Android, etc) resides in a separate platforms folder:
Project Root Folder
|- platforms
|- iOS
| - www
|- android
| - www
|- www
|- css
|- js
|- index.html
The documentation says that you should not do any editing of files in any of the platforms www folders because the build process copies the files from the root www folder to each www folder in platforms.
The iOS folder contains xcodeProject file that opens the iOS platform's specific www folder (not the root folder). I understand that the www folder under iOS is specific for iOS platform. But this means you cannot use XCode to edit any of the files you see. Right now XCode is useless as an editor as it edits the wrong files.
How are we supposed to utilize Xcode against the root www folder? Thanks for your help.
I'll show you how my team works with Cordova on iOS. This may not be the way recommended from the documentation but it works (Besides, the documentation has never been reliable).
We develop an Android version side by side, for Android, following the documentation works quite well:
Copy files to www folder
Execute cordova build android
Copy the compiled app from platforms/android/bin folder
However, for iOS it gets tricky. As you mentioned above, there is the xcodeProject file. If you made any changes from xcode, executing cordova build ios will definitely overwrite those changes. We also found that running cordva build ios a second time will corrupt the config.xml file - invalidating all the plugins we need to run the app correctly (this is true as of 3.3.0).
So the recommended approach for our iOS team is to:
After creating the iOS project file (xcodeProject) using cordova build ios.
All changes to the HTML files should be made to the folder platforms/ios/www/.
The root folder www will not be touched.
Compiling the iOS IPA is done exclusively within Xcode.
This approach works for us since we compile our Android build file separately on a Windows PC. If you use one system for multiple platforms then it could be wiser to make all your changes to the root www and then creating a symbolic link at platforms/ios/www/ - still keeping Xcode for compiling iOS and cordova build ** command line for other platforms.
Hope this helps!
Related
I have created ios project with cordova 4.1
The problem that when I have removed some plugins , the ios folder refreshed and all my works lost .
Its create new www and ios folders , there is any way to recover my last ios and www folders ?
Create project expects a directory that does not exist.
See cordova create project look for path.
Quoting:
path: Directory which should not already exist. Cordova will create this directory. For more details on the directory structure, see below.
I am trying to build a Cordova app. All is set up fine, but I am confused now.
There is a www folder in the main folder which is displayed in Xcode. But there is a second in platforms/iOS. This folder is used when I am building the app.
Is that the way it should work? Or can I tell Xcode to take the other folder and not the www in root?
THANKS!
EDIT: And where to locate config.xml? Because in root the iOS App will not find any plugin e.g.
EDIT2: Got that with plugins! Have to install them over terminal
Yes this is a way Cordova is working.
The www in the main folder is the place where you have to implement you changes if you willing to support more then one platform. That folder copied to the platforms/ios/www each time when you run cordova prepare ios and this is actual folder which will be bundled with you iOS application. You you made changes in you main www folder and forget to run cordova prepare ios then you would not see you changes in you application if you run it. You have to run cordova prepare after making changes in the www in the main folder of you app.
Note: If you using cordova build or cordova run then you don't need to call cordova prepare, these commands will call it internally during the run.
As of Cordova 3.5 folder www in the Xcode which you see is same folder which is located in you main appication folder, and folder Staging->www in XCode is folder pointing to platforms/ios/www folder created by cordova prepare for you.
Before Cordova 3.4, www folder in XCode was pointing to platforms/ios/www folder.
I would recommend you made changes in www subfolder of you main folder and run cordova prepare\build\run to build/run your application if you plan to mainly work with HTML + JS or your application would support more then one platform. Otherwise, if you app is strictly iOS you could made you changes directly in Staging->www inside XCode and test you changes immidiately
You could start reading about development path with Cordova here: http://cordova.apache.org/docs/en/3.5.0/guide_overview_index.md.html#Overview_development_paths
More information about using Cordova CLI is here:
http://cordova.apache.org/docs/en/3.5.0/guide_cli_index.md.html#The%20Command-Line%20Interface for explanation of the workflow.
www folder in root level has html, javascript etc. When you build your code, same www folder for each platform will be created. So If you make any code changes in main www folder. You should rebuild the code for specific platform each time. Then only your changes in the main www will be applied in the platform specific www folder.
I'm quite new to Xcode (5.1), and I'm trying to build up a cordova application.
Basically, I created a new project using cordova through the CLI. I also added several cordova plugins this way.
And I replaced the original hello world www folder with the one of my project.
I get one issue, "Semantic Issue", Method definition for 'makeEntryForPath:isDirectory:' not found. and there seems to be a silent JS crash of the app on the testing device.
File is the first plugin I installed, and I guess it's not found, because not located at the right place.
In fact, I'm quite confused with the Xcode directory structure, which present several duplicates. There's a config.xml and a www directory at the root level. Some others are in a Staging directory. Plugins are located at the root directory as well. But I noticed that I had to manually copy some files in the Staging/www/js folder, where it seems that the app is looking for, as told by Safari's remote debugger...
Do you know where I could find a general overview of what a cordova/Xcode project structure with plugins should look like?
Thanks
i've a cordova project created via cordova cli command.
i build the project for Android and iOS platform but... i copied the build project into respective workspace (eclipse/xcode) and i updated that single project.
Now i need to add a plugin.
The project into cordova project folder is now so outdate so i would add the plugin via cli and copy the plugin to the respective project.
I copied successfully the generated plugin into the android project, but i'm not able to do the same thing with iOS.
For example i added the console plugin for iOS
cordova plugin add org.apache.cordova.console
if i open and run the build project it work and i see my message in console, but if i try to copy the generated plugin into my existing project it doesn't work.
nobody could help me to understand how add manually a plugin into my existing project?
update
yes i know, i'll try to explain better
i have my cordova project under folder /Document/cordova
when i made an ios build via command line cordova put the built project under /Document/cordova/platforms/ios
well i copied the folder ios under /workspace/my-project-name
after some work under workspace i see that i need to add a cordova plugin.
i added the plugin via command line and it was added to /Document/cordova/platforms/ios
at this poin i have a project under /Document with plugin but asset outdated and one project updated without plugin under /workspace
i'm trying to copy from built project to /workspace project.
i copied
/workspace/my-project-name/my-project-name/Plugins
/workspace/my-project-name/my-project-name/config.xml
/workspace/my-project-name/www/plugins
/workspace/my-project-name/www/cordova.js
/workspace/my-project-name/www/cordova_plugins.js
but it doesn't work... i missed somethings?
After reading it several times I think I get more less the idea...
Well, I am not sure why do you want to copy the ios project outside the current location. I suppose you have a good reason to do it, however you can always tweak that project instead of going back and forward, cordova will not impact non cordova related files each time you run "cordova build".
Are you familiar with control versioning? Git, SVN, mercurial? If so it is simple just we which files were impacted once you add the plugin and copy those... If no, I suggest using control versioning anyways to help keep track of your code changes.
NOTE: Be aware if you build the cordova projet and then you just want to update the files noted above it is highly likely that it won't work, that is why you run "build" is not a simple file sync. I recommend taking the new cordova project with the plugin added and then just add you personal tweaks on the ios in the other folder. Or just tweak the ios folder inside platforms folder...
I hope you are doing for good reason. Anyway you are missing to copy below file to work
/workspace/my-project-name/my-project-name/platforms/ios/my-project-name/config.xml
Copying the cordova iOS platform folder is not a good idea. The reason is, cordova builds an Xcode project in the platform folder, and there is some sort of caching/built in references to absolute location of the original Xcode project. Therefore it would be unclear to you and to Xcode which file is being referenced from within Xcode. This may have caused some other unnoticed errors in the project as well. So therefore, instead of keeping original project path available along with the new path, I would recommend renaming the original project folder in order to remove the ambiguity. This way, you will assure that the right file versions are referenced.
I am trying to build a BlackBerry 7 and earlier project that uses the WebWorks SDK using Phonegap 2.9; but the build doesn't generate the StandardInstall.zip file as it's supposed to.
The project I'm trying to build is the example app found in the Phonegap 2.9 download (phonegap-2.9.0\lib\blackberry\bbos\example).
I followed the instructions in the Phonegap documentation and there is an overview of my environment:
My OS is Windows XP, I've got JDK, ANT and BlackBerry device manager installed. I've also installed the BlackBerry Webworks SDK and I've setup my Signing Keys (sigtool.csk and sigtool.db are in the bin folder of the webworks installation).
I also updated the project.properties file as explained in the documentation.
When I try to build the app, It doesn't print any error message, but the OTAInstall and StandardInstall folders are not generated (all I get is the zipped application folder and a widget folder).
I also tried deploying to simulator and to device, the errors thrown confirm just that the build step doesn't generate the files it should.
Screenshots: http://i.stack.imgur.com/XpN4M.png
Solutions I already tried:
JDK version problem
I downgraded JDK to 1.6.0_30 version (it seems that the Webworks SDK doesn't work with upper versions); but it didn't change anything.
White spaces
I also tried to avoid white spaces in paths like advised in other posts but it doesn't work:
C:
├ \ant
├ \java
└ \webworks
I don't know what else to do, any help would be much appreciated !
To make a blackberry phonegap project, the things you need are:
Phonegap (cordova libs)
BlackBerry WebWorks SDK
Ant, through which you will build your project.(Also add 'ANT' in you environment variables).
The steps to create a phonegap build:
Open the phonegap sample that came with it. Follow the location -
phonegap-2.3.0\lib\blackberry\sample
Copy cordova folder as you see the sample folder
Copy lib and www folder also. The lib folder contains the cordova library. The www folder is the only place for your files.
It contains your html, css, js and the config.xml
Copy blackberry.xml, build.xml and project.properties files.(change the properties in these files as per your project configurations)
'Build' folder is created once you run the script 'ant blackberry build'(To build the project) or 'ant blackberry load-simulator'(Build and run on simulator) or 'ant blackberry load-device'
Once you have built the project you can run it on device using the .cod files.
When you run the above build scripts you get the build folder in your PhonegapBlackberry project which looks like:
Setting the correct Java jdk home path in bbwp.properties file of my <BlackBerry SDK>/bin folder works for me.
Thanks,
prodeveloper.