Hello guys.. we are back once again with another hot topic i.e: Development of iOS apps using Xamarin for Microsoft Dynamics. It sounds much innovative and interesting. Briefly, we will cover which platform we are using, application architecture and deployment.
Currently, we are in the age of Mobile technology. Some statistics shows some great exponential growth in mobile usage worldwide and can give you 24/7 access of your client,customer or business. So why not we can have purchase order receiving feature in our mobile? Why not one can have mobile device portal,featured in Dynamics AX, in his/her own mobile? I think it is just like blessing if we can have some of great functionalities in a mobile app. There are a lot of services providing for mobile development in Android and iOS. According to statistics, these platforms cover more than 90% of mobile devices being used worldwide. So it will be more great to have a single application for mobile that can run easily on Android, iOS and Windows Platform. This lead to the concept of Hybrid or Cross Platform Mobile Development.
There are a lot of tools and platform available for cross platform mobile development. But one of the most common and popular tool is Xamarin. It helps you to build native apps for multiple platforms using a shared C# based code. You can have its own IDE i.e: Xamarin Studio or you can build apps on Visual Studio having Cross Platform Mobile Development project. Particularly, for Mac, Xamarin Studio has been obsolete. Therefore, we now have Visual Studio for Mac in place of it. For further details, you should see my previous blog here.
2) Application Architecture:
I think it is the most important part of any application. It is similar in a way that if your base is strong, you can achieve anything. First of all , we will develop app on Xamarin using Visual Studio for Mac. It is easy to work on Xamarin as it has C# as its back end language. Then you have a mobile gateway hosted on IIS server which will help you in communicating with AX 2012/2009 via AIF document and custom services. Following is the diagram of architecture:
3) Deployment in iOS devices:
After development, it is necessary to test your iOS app on real devices. For this, you have to provision your iOS device. You might have a question regarding why should we test on real device if we are having simulator. Its good to have a simulator but sometimes your app might run great on simulator but it can be crashed or struggled on real device. So it is very important to test it on real iOS device. So for deployment, we have to do four basic things:
1) First of all register yourself with Apple for developer account. It can be free as well as paid account. Actually , you need to have paid account for publishing app in App store or create an enterprise app. So you do need to register your account(keep it simple by registering free account first time).
2) Second we will need some signing certificates to make sure this app is valid to run on iOS device. If you do not have certificates, the app will not be installed.
3) Third we will have iOS device connected with Mac via USB cable.
4) We will need provisioning profile that ties all this together. It tells us about set of devices that are capable of running that application.
1) Apple Developer Account:
Create your Apple Developer account by clicking on this link.
2) Deploying on iOS device:
In order to get development certificate, create a new Xcode project and select ‘Single View Application’ from template section. A window will appear. Fill the required fields of your choice and then click Next. Another window will appear. You can uncheck ‘Create Git repository’ option and then click Create.
Under the Identity Tab, you will have an error ‘No code signing identities found’. If you click in ‘Fix issue’ button just below it, you will be prompted to add an Apple ID account. So just add it which you made it in first step. By adding, you will then have your team under the Team dropdown in the same tab. Just select your team there.
Now, plug in your iOS device into Mac through some USB cable and then you see that error will be gone. In case, if you are getting some other error of provisioning profile(although it automatically creates), then you should refresh your signing certificates first by just going to Xcode > Preferences > Account > View Details and then click on refresh button at the bottom of window.
After all of this, come back to Visual Studio for Mac and then run your application(make sure type Debug is selected and your iOS device is connected with Mac). The app should be installed on your iOS device.
Hope this blog will help you in future regarding development and deployment of iOS application. Stay tuned for more exciting blogs ahead. Bye until then!