In this blog, you will learn how to Create a Crash Report Using Visual Studio Mobile Center in Xamarin iOS, using Xamarin Studio.
Introduction
Xamarin is a platform to develop cross-platform and multi-platform apps (for example, Windows phone, Android, iOS). In Xamarin platform, the code sharing concept is used. In Xamarin Studio, Visual Studio is also available.
Visual Studio Mobile Center is mission control for your mobile apps
Bring your apps written in any language to Visual Studio Mobile Center’s cloud and lifecycle services and you’ll get faster release cycles, higher-quality apps, and the time and data to focus on what 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 This link https://mobile.azure.com and log in with your credential
Step 1
After Login 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.
OS :iOS
Platform :Xamarin
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 single 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 Package 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 the 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) { // Note: this .ctor should not contain any initialization logic. } public override void ViewDidLoad() { base.ViewDidLoad(); MobileCenter.Start(MOBILE_CENTER_ID, typeof(Crashes)); // Perform any additional setup after loading the view, typically from a nib. } partial void BtnClick_TouchUpInside(UIButton sender) { throw new NotImplementedException("Not Implement Exception"); } public override void DidReceiveMemoryWarning() { base.DidReceiveMemoryWarning(); // Release any cached data, images, etc that aren't in use. } } }
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 be Crash.
Now you can Go to the Mobile Center your app crash tab,The Crash Report will writen Successfully.
Summary
This was the process of how to Create a Crash Report Using Visual Studio Mobile Center in Xamarin iOS , using Xamarin Studio.
Thanks for sharing this informative content , Great work
ReplyDeleteLeanpitch provides online training in Advanced Scrum Master during this lockdown period everyone can use it wisely.
Advanced Scrum Master Training Online