convert phonegap App to iOS

匿名 (未验证) 提交于 2019-12-03 01:45:01

问题:

I developed an android application with Phonegap and I want to port it to iOS as well. Is that possible? I don't what to do with my java files!? All I see in Phonegap sample project in MAC are objective C. How can I import my java files to XCode and compile them?

回答1:

Unless you are developing a PhoneGap plugin, you will be dealing with just HTML/JS/CSS files. If you developed Android Plugin, you have to re-implement the same functionality in Objective C. Otherwise, just copy over the files inside assets/www to www in XCode project folder and compile it.



回答2:

I thought that the point of phonegap was that you wouldn't have to 'port' the application over, that it should run/compile/whatever on iOS and Android without a whole lot of judo to make it work.

My point is I don't think that's possible, you will have to re-write your java stuff in Objective C, or go back through the phonegap documentation to see what language and techniques you have to use to avoid having to port one to the other.



回答3:

The application that you have build on Android using PhoneGap can be executed on iOS device as well. Simply copy the content of 'www' directory of application in 'www' directory of Xcode and run it. This will build an required iOS App. The below image shows directory structure of PhoneGap App.



回答4:

Yes, you can surely port the Android code to iOS in PhoneGap. But there is one case where you may face the problem i.e. if you have used any plugin for Android, which will be a .java file, then you need to re-implement it for the iOS in Objective C code with same functionality.

But if you have not used any plugin code, then you would have just worked with the HTML,CSS and JS files, which are clubbed into one single folder, i.e. www. So you may copy that in the XCode project,and compile it. It will run as smooth as in Android.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!