Introduction
Xamarin is a platform to develop cross-platform and multi-platform apps (for example, Windows phone, Android and iOS). In Xamarin platform, the code sharing concept is used. In Xamarin Studio, Visual Studio is also available.
Visual Studio Mobile Center is a mission control for your mobile apps.
Bring your apps written in any language to Visual Studio Mobile Center’s Cloud and lifecycle Services. You will get faster release cycles, higher-quality apps and the time and data to focus on what the users want.
Learn more.
Prerequisites
- Xamarin Studio.
- Xcode.
- Mobile Center account
The steps given below are required to be followed in order to create a Crash Report, using Visual Studio Mobile Center in Xamarin iOS, using Xamarin Studio.
Go to the link https://mobile.azure.com and log in with your credentials
Step 1
After login to Mobile Center, create a New App in Mobile Center site.
Add New—> Add New app.
Step 2
In this step, give your app Name (Ex:XamainiosCrashreport) and description.
Afterwards, click Add New app.
Step 3
In this step, go to Manage App and general information. Copy your app secret key.
Step 4
Go to Xamarin Studio.
Click New Solution—> select iOS—>select App--> Choose Sngle View App. Afterwards, click Next.
Step 5
In this step, configure your app. Give the app name (Ex:sample), Organization Identifier. Afterwards, click Next.
Step 6
In this step, give your project name (Ex: Sample) and solution name (Ex: Sample). Give the path of your project. Afterwards, click Create.
Step 7
Subsequently, go to the Solution. In the solution, get all the files and sources in your project. Now, select Main.storyboard and double click to open Main.storyboard page.
Step 8
After opening the Main.storyboard, you can design this page, as per your desire.
Step 9
In this step, design your app, using storyboard and Toolbox.
Button (btnCrash)
Step 10
In this step, add two packages in your project.
- Mobile Center
- Mobile Center Crashes
Go to Solution Explorer—>Package—>Add Package.
Now, choose Mobile Center, Mobile Center crashes and select Version. Afterwards, click Add Package.
Step 11
In this step, go to ViewController.cs page. Write the code given below.
ViewController.cs
- using System;
- using UIKit;
- using Microsoft.Azure.Mobile;
- using Microsoft.Azure.Mobile.Crashes;
- namespace XamariniOSCrashReport {
- public partial class ViewController: UIViewController {
- public
- const string MOBILE_CENTER_ID = "8f7b790d-cafc-4555-ad29-5a784375ac89";
- protected ViewController(IntPtr handle): base(handle) {
-
- }
- public override void ViewDidLoad() {
- base.ViewDidLoad();
- MobileCenter.Start(MOBILE_CENTER_ID, typeof(Crashes));
-
- }
- partial void BtnClick_TouchUpInside(UIButton sender) {
- throw new NotImplementedException("Not Implement Exception");
- }
- public override void DidReceiveMemoryWarning() {
- base.DidReceiveMemoryWarning();
-
- }
- }
- }
Step 12
Now, go to Run option, choose Debug and the list of iPhone and iPad Simulators, which are available. You can choose any one Simulator and run it.
Output
After a few seconds, the app will start running on your iPhone Simulator.You will see your app working successfully.
You can click Button app will crash.
Now, you can go to Mobile Center and the Crash Report will be written successfully.
Summary
This was the process of how to create a Crash Report, using Visual Studio Mobile Center in Xamarin iOS, using Xamarin Studio.