Hybrid Application development for android is a breeze, be it for development or production configuration, however i personally find cordova iOS setup, development and deployment a bit complicated.
Most of the Hybrid Application Developers who are in learning stage are not able to explore hybrid iOS app development process due to the simple reason that they dont own a mac, since developing iOS apps requires the iOS SDK and XCode unlike Android SDK which runs on any Desktop OS. Therefore the aim of this guide is to show the basic workflow of hybrid iOS app development on a mac, so that a developer even if he/she cannot develop iOS apps, is atleast familiar with how its done.
Begin by opening the terminal and creating a new cordova project ( use sudo only if you have permission issues, ie. EACCESS errors ) :
```
sudo cordova create iosdemo
cd iosdemo
sudo cordova platform add ios
```
At the time of writing this guide cordova iOS platform version is : 4.3.1
We wont modify any source code of the app and simple continue with the default sample code that is added by cordova automatically when we run the create command. However it is assumed we will add plugins modify code in the ```www``` folder during normal development flow.
Next step is to run the cordova build command. This will convert our app code to an .xcodeproj file which we will use next.
For pricing of an Developer account refer <ahref='https://developer.apple.com/support/purchase-activation/'alt='apple developer account pricing'target='_blank'>this page</a>
Once you have the account ready we can proceed further and login to <ahref='https://developer.apple.com/account/'alt='apple developer dashboard'target='_blank'>Apple developer account</a>
The dashboard screen should look something like this :
<imgsrc="https://image.ibb.co/j0d8zQ/Clipboard_image_2017_09_18_11_35_58.png"alt="Project opening in Xcode"width="100%">
Click on ```Certificates, Identifiers & Profiles```
This should take you to the following screen, which by default displays Certificates issued from your account :
iOS Certficates are of mainly two types : Development or Distribution, click on the Plus (+) button on the top right corner of the list which will open the following page :
App Description can be any related name this will be displayed in the app id list against the particular app id.
An app id is a string in the format *AB11A1ABCD.com.mycompany.myapp* where *AB11A1ABCD* is the app id prefix which is by default the team ID and *com.mycompany.myapp* is the bundle ID which is unique to each app.
It's recommended that the bundle id must be in a reverse-domain name style string for example, the company MYCOMPANY may have two apps (App1 and App2), therefore the http url for each app is usually app1.mycompany.com and app2.mycompany.com,
In the file selection dialog that pops, navigate to the path where the development provisoning profile is downloaded, and select it. It will have an extension of *.mobileprovision*
The build status will be displayed in the status bar on the top of the window.
If all goes fine, the app should be installed on the device, and automatically load in a while.
## Running the app on a simulator
The steps are same as running on device, but instead of an actual device we use the available iPhone and iPad simulators from the device list.
## Generate an ipa file for distribution
This approach can be done in case you require to distribute the app to the testing team, etc. However the device used by them must have a UDID present in the provisioning profile.
From the Xcode menu select ```Product``` -> ```Clean```,
Then ```Product``` -> ```Archive```,
The Archives organizer appears and displays the new archive.
To distribute your app to users with designated devices, select “Save for Ad Hoc Deployment.” The app will be code signed with the distribution certificate.
To distribute your app for internal testing, select “Save for Development Deployment.” The app will be code signed with your development certificate.
<imgsrc="https://image.ibb.co/jQJLMG/6_ios_createappstorepackage_1_2x.png"alt="ios archive organizer export as ad hoc"width="100%">
In the dialog that appears, choose a team from the pop-up menu and click Choose.