In previous tutorial we have seen how to create hybrid mobile apps powered by IBM Bluemix.In this tutorial we will see how to create iOS 8 app on Bluemix platform.Bluemix provides different options for creating hybrid app and iOS app.The hybrid app does support Android as well as iOS.
So if you want to cross platform mobile app then you should go with Hybrid mobile app option.For iOS specific app development you can use iOS 8 option.Also you can read about both the options and select the one which serves your purpose.
The initial few steps of creating iOS 8 app with Bluemix are same as that of Hybrid Mobile App.So you can read that article for initial step details.After creating Bluemix account (which does have trial version and you do not have to add credit card details in trial version).I have used trial version account to test Bluemix and write these articles.
For your iOS app Bluemix acts as a server which stores data and is accessible from your app using REST API’s.The data stored on Bluemix is only accessible to your App.It also provides support to Push notifications.All the server part is available without any need of coding.You can see the architecture of Bluemix iOS 8 as shown above.
Step 1 : Name Bluemix Mobile App
As mentioned above Bluemix provides two options for creating mobile app Hybrid App and iOS.You should select iOS from the options.After selecting iOS you can see below image
Click on the continue button on the image shown.After you click on the continue button on next screen you will have to enter your app name.Your app name becomes part of URL (free one).For example my app name was UdinraIOS8 so the URL became https://udinraios8.mybluemix.net.Note your app name should be unique.If it has already been used by any user then you can not use that app name.
Step 2 : Bluemix iOS8 Services
With every iOS 8 Bluemix creates three services
- Advanced Mobile Access
These services are covered in detail later in this post.
Step 3 : Bluemix iOS8 Service CloudantNoSQLDB
This service acts as data store for your application.The database is accessible easy to use HTTPS REST API’s.By default Bluemix creates a database similar to your App Name.You can click on the server block from Dashboard.On the next page displayed you can see more details about the service along with Launch button.
If you click on Launch button you a new window is opened.On this new window you can add new documents to your database.Adding new documents to database is as easy as browsing the file on your system and uploading the file.Every document you add in your database is accessible as JSON via a URL.
You can perform all kind of operations on the documents from the App (using Rest API) as well as Bluemix front end.You should not worry about any Database Administration tasks.Everything is taken care of by IBM.You just have to focus on needs of your App.
Bluemix frontend also supports important tasks like Replication and Warehousing.You also have option to enable CORS (Cross-Origin Resource Sharing).You can also enable database to accept request for all domains or list of specific domains.
Also you can add Virtual Hosts (that is map your domain to Cloudant server or part of it).All these are available using easy user interface.There is no coding effort involved.I would discuss more about Bluemix Cloudant DB in a separate post.
Step 4 : Bluemix iOS8 Service Push Notification
Bluemix iOS 8 app supports Apple Push notification service.You can configure the push service by uploading .p12 certificate to Bluemix.These certificates are required for production as well as sandbox environment.You can get these certificates from Apple developer account of yours.
Bluemix allows you to send notifications to all registered mobile devices,specific consumer id or by tag.You can create tags from Bluemix dashboard.You can then add tags to your App and let the users subscribe to tags as per their preference.Then you can direct notifications to tags.
It helps you club similar users and send same message to all of them in one go from the Bluemix dashboard itself.Below image shows the notification screen.You can also see your Push performance and devices registered for push notification over a period of time.
Step 5 : Bluemix iOS8 Service Advanced Mobile Access
In Client Server App architecture security is one concern.You do not want your API’s to be accessible to others.If anyone can access your API then your data is no longer protected.Using API your data can be stolen or deleted.So it is very important to protect your API from unauthenticated access.
Good amount of development time is invested in securing API.Perhaps writing API is easier than securing API’s.Once you think about securing it your API code becomes lengthy and development time increases significantly.Bluemix takes this load from you.
You do not have to worry about securing your API’s.Using Bluemix Advanced Mobile Access you can easily make your API accessible from clients or apps you want.All of this from simple user interface only.Also you can configure if user of your app should login to use your App or not.Currently it supports Facebook,Google and custom authentication.
Custom authentication is not available in Bronze plan.If you are using Trial version of Bluemix then the App created will have all the services in Bronze plan.In this plan you can have only Facebook user authentication and Google user authentication.
All the statistics of the App is available on Monitoring option of Advanced Mobile Access service.The Monitoring option has Usage,Network,Devices,Device logs and Authentication sub options.Each sub options displays statistics related to it.
Step 5 : Bluemix iOS8 dashboard
After creating the App (step 2) you are redirecting to iOS8 app dashboard.From dashboard you can
- Navigate to different services mentioned above
- Increase/Decrease number of instances running
- Increase/Decrease the memory used by single instance
- Start or stop an app
- Access files/logs/environment variables associated with your app.
There are several differences between Hybrid Mobile App and iOS mobile app services created by Bluemix.Quality Assurance Service is present in Hybrid Mobile App but not present in iOS8 mobile app.Rest of the services are more or less same with some changes in user interface.