Lost my ios and www folders - ios

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.

Related

Which should I use the www folder for cordova iOS project?

root/www files in the project does not work when I put it here
iOS platform project/www files in running.
but Cordova build can be reset and check this folder by deleting files?
Which is the correct folder for the project files? and how to prevent file loss during builder?
Thank You...
The correct folder for developing is the www in root.
If you don't want to use cordova build over and over again, you can symlink the content of this folder to the content of the platform www folder.
Or you can write a script, which is running before compiling. This script copies the content to the www folders.
Attention:
Don't copy the whole folder to the platform folders, because in the platform www are some specific scripts, depending of your OS.

Cordova iOS App which is the right www folder?

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.

What should an iOS cordova project structure look like?

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

Incorrect www folder in xcode project created by cordova 3.4.1-0.1.0

I create a new app and add the ios platform. When I open the xcode project the files from www folder are not correct.
Example of my xcode project files that are opening:
Correct way: app_folder / platforms / ios / www
My project: app_folder / www
screenshot: http://i.imgur.com/2M0gFLm.jpg
This only happens in this version of the cordova. In earlier is ok.
Phonegap 3.4.0 stucture will changed if you need www folder what we need to change is in
project->staging -> www

PhoneGap 3.3 project structure and editing code

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!

Resources