copy paste of www folder from one to another project is not working properly - hybrid-mobile-app

I have one ready-made project and I want to use basic functionality of ready-made project into another project. So, I have pasted www folder into another project but giving some popup errors.
Project Root Folder -> platform -> android -> app -> src -> main -> assets -> www
copy this www folder into new project

You can re-use www folder from one project to another project but make sure
www -> cordova.js
-> cordova_plugins.js
these two files cordova.js and cordova_plugin.js should not be replaced in another project.
Rest all the files can be re-used but not these two because of sometimes may have version difference.
In your case, you can copy all the files from www folder to another project without cordova.js and cordova_plugin.js. It will resolve pop issue.

Related

Is there a way to copy bundle resource to app folder when built finished?

Actually I have a xcode workspace, containing several projects, for example, projectA and projectB, projectA is the main project, and projectB will generate a bundle file which projectA will use, is there a way to copy the bundle file to the main app folder? I know one way to do this is to drag the generated bundle file here like the below image shows, but as we have several team members and use git to manage the project, this method will use my personal folder path, and when others want to build the project, they will have to drag the bundle again. Is there a way to copy the generated bundle using relative path? Or can I use a script to do this? So everyone can just checkout the code directly without dragging the bundle manually? Thanks.
In Target -> Build Phases can you just Run Script after that target is done to copy it to the other place?

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.

Copy an existing Xcode project results in files with wrong references

I have a working project that builds ok. (Xcode 6.0.1)
There were images added that were at one folder (/Downloads) and were substituted by new ones (/MyDir/MyProject).
At adding files process copy options, group and add to it's targets were selected.
After a copy and paste at Finder from the root project folder to the new project some images contain references at Targets / Build Phases / Copy Bundle Resources to old folder (Downloads) while they are ok at original project.
I've deleted the .git from initial project to make sure it's not a git problem.
Already tried
rm -rf ~/Library/Developer/Xcode/DerivedData/
Any ideas? Thank you
In the rightmost panel, which contains Identity and Type, check to see if the "Location" field is Absolute Path, Relative to Group, or Relative to Project, and set each file accordingly to what it should be. Xcode seems to create new files with creative ideas on how this should be set.
check in your project build phases if there are some missing references and delete the one you don't need

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.

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