Mixing cordova web and native iOS code - ios

I have inherited a Cordova project that mixes web code with native code.
I'm using cordova CLI 6.3.1 and the cordova ios platform version is 3.9.2.
Whilst working I come across this warning in the console.
Using this version of Cordova with older version of cordova-ios is
being deprecated. Consider upgrading to cordova-ios#4.0.0 or newer.
However, when I try updating the ios platform version using cordova platform update ios --save it completely wipes out all files in the "platforms" folder - which currently includes all the custom iOS project files, i.e. custom classes and what not.
Is there something fundamentally wrong with our project setup?
What is the recommended way to mix and match cordova web and native iOS code so that updating the cordova ios platform doesn't nuke everything?

Generally, the files under /platforms are generated on the fly based on changes that are made in /www. Running cordova prepare ios, cordova build ios, cordova platform update ios, or cordova run ios, will always nuke the platforms/ios folder and retreat it based on /www.
You mentioned your project has custom native code. Is that native code built as a cordova plugin? If so then you should be good following the standard workflow. Work in /www. Test your project cordova run ios.
If not, you might want to consider refactoring the native code you have as a plugin.
Look at this plugin's code structure as an example.
Follow this guide on how to start developing a plugin.

Related

defining the architecture specific cordova plugin libraries to use in capacitor/react project

As has been mentioned in https://github.com/cordova-rtc/cordova-plugin-iosrtc/blob/master/docs/Building.md#apple-store-submission in order to submit the app to App Store we need to strip simulator (i386/x86_64) archs from WebRTC binary and as the very last step to do so it says:
Remove ios cordova platform if already added and add ios platform again (e.g. with a command cordova platform remove ios && cordova platform add ios) or remove and add only the plugin at your own risk.
I have a capacitor/react project in which I am using the above mentioned cordova plugin. And unfortunately you can not use cordova commands in capacitor/react environments!
How can I invoke such command in a capacitor/react project or is there any equivalent steps I can take to get the same result?
Those are cordova instructions, for Capacitor just run npx cap update ios or npx cap sync ios

Build Ionic Application From Xcode Project

I'm building an iOS application using Xcode/Swift, and I have a few less-than-technical group members who don't really know how to build Xcode projects, but are interested in seeing/testing the progress of the application. One group member pointed out that they could test the app using Ionic/Ionic View. However, to my understanding, Ionic works by building an application in the specific Ionic framework, and then Ionic translates the project into an Xcode/Swift project (.xcodeproj) or an Android project. Is there a way to do the reverse conversion––is there a way to convert my Xcode project so that it will work on Ionic, or specifically Ionic View?
Ionic is tool like cordova created to develop hybrid apps (from HTML+JS+CSS --> to Native iOS/Android/WinPhone/BlackBerry). The UI is running in native webView, and using some native functionalities by plugins but it is not created to make Ionic/Cordova app from native.
If you want to share your app to tests, use Apple TestFlight
'Ionic View' is a very good advice and the one I would suggest in your case as well.
You don't have to do anything in your code really to use it, just create an ionic account and in your terminal, change into your ionic project directory and then type:
$> ionic upload
You will be asked for the usernmame and password of the account you just created, the application will be uploaded and you will get a unique app ID. You can then share that ID with anyone who you want to test your app, as long as they have the Ionic View app installed on the their iOS or Android devices.
Also do make sure you have updated your global ionic and cordova packages to the latest version before you upload:
$> sudo npm uninstall -g ionic && sudo npm install ionic
Now, as 3squad mentioned, many of they Ionic Native plugins are not supported so don't expect everything to work, but it's a good start to show most of your app and design running.
Here's a list of currently supported plugins.
Please do keep in mind that the performance using Ionic View will be far worse than if you actually build, release and give your users and actual production .apk or .ipa file to install. This latter approach would also showcase the full, final performance and functionality resulting from your code, but it may be more cumbersome.
Here's how to release a production version of your app.

Deployement Error for iOS in VS Cordova

VS version - 2015 with Cordova update 3Mac OS - 10.10.4iOS - 9.0 When building in release mode for iOS we get following warnings. But release folder is created with ipa and plist.
So when uploading that ipa using application loader it gives following 2 errors.
As I mentioned in this stackoverflow thread:
There appears to be an issue with Cordova's iOS implementation when publishing apps created specifically using Xcode 7.
A Cordova community member has published a "cordova-plugin-ipad-multitasking" plugin with a fix.
http://npmjs.com/package/cordova-plugin-ipad-multitasking
Install this plugin and you should be all set. A future Cordova version will resolve the problem fully.
Failing that, if you are using remotebuild you can also find the native project under ~/.taco_home/remote-builds/taco-remote/builds and make the modifications as described in the Cordova bug on the issue.
EDIT:
To resolve ITMS-90339, there is a second step you can do to patch in the near term. Grab the build.xcconfig from the 3.9.x branch of the cordova-ios repo and place this under res/native/ios/cordova
Now remove this line:
CODE_SIGN_RESOURCE_RULES_PATH = $(SDKROOT)/ResourceRules.plist
Note that you will want to remove this custom build.xcconfig file if you upgrade to the version with the full patch that is forthcoming.

Can a mobile application built with Cordova (not PhoneGap) be compiled on Adobe website?

I am building Mobile applications under Windows 7 and I am trying to compile for iOS.
I have to use Cordova 3.5.0 because the latest PhoneGap, the 3.4.0
Will not do the job for me.
Can an application designed with Cordova, not PhoneGap, be compiled for iOS on Adobe PhoneGap website?
Yes and no.
In your case, no. This is because you need to use 3.5 and Build does not currently support 3.5
You can with most projects, create a new config.xml that has all of the extra config tags for Build (plugins, icons, platforms, etc.), zip your www folder and upload to PGBuild.
I say most because you can't upload plugins that you made, or plugins that aren't supported on PGBuild. And you have to remember that the config.xml you use for Cordova is not the same as the config.xml you will need for PGBuild.

How to include phonegap application in the iOS

I am creating a phonegap application in ios and i am following below mentioned link
http://docs.phonegap.com/en/1.9.0/guide_getting-started_ios_index.md.html
It is said in the link that we need to download the phone gap, which i had done already
and then click on the cordova based application, but in my app I am not getting the options
to select the same.
So can anyone suggest how it can be done?
PhoneGap installation process has been changed. You will not get any template in Xcode and we can do is creating app in terminal
List of this you need to install phoneGap are
1. node.js
2. cordova
3. phonegap
first install node.js and then phone gap/cordova
once your installation is completed open terminal and then create a cordova based application
use this for creating process
http://cordova.apache.org/docs/en/3.3.0/guide_cli_index.md.html
this for plugins
http://docs.phonegap.com/en/3.4.0/cordova_plugins_pluginapis.md.html#Plugin%20APIs
cd to your workspace
cd /Users/xxxx/Desktop
create cordova project
cordova create your-project-name
cd to your project
cd your-project-name
add ios platform
cordova platform add ios
build your project using cordova build
cordova build ios
done !!
Reference: http://blog.revivalx.com/2014/02/21/crud-operation-using-jquery-mobile-on-android-part-1/

Resources