[Huawei Developers] Mayism:
We've introduced how to integrate AppGallery Connect Crash to an Android app. The integration procedure for an iOS app is similar. Let's take a look. you can also download the codelab to integrate.

Creating Your Project and App

First, you need to create a project in AppGallery Connect and add an app to it. For details, see the AppGallery Connect documentation.

Enabling HUAWEI Analytics

The Crash service uses capabilities of HUAWEI Analytics when reporting crash events. Therefore, you must enable HUAWEI Analytics before integrating the Crash SDK. For details, please refer to the AppGallery Connect documentation.

Integrating SDKs

If you are using Xcode, you can integrate the Crash SDK into your Xcode project with CocoaPods.

1. Sign in to AppGallery Connect and click My projects.

2. Find the project you created from the project list, and click the app for integration on the project card.

3. Go to Project Settings > General information, and click agconnect-services.plist under App information to download the configuration file.

4. Add the agconnect-services.plist file to the Xcode project directory.

5. Create a Podfile.

Open the CLI and navigate to the location of the Xcode project. Then, create a Podfile. Skip this step if a Podfile already exists.

cd project-directory
pod init

6. Edit the Podfile.

1) Integrate the Analytics SDK and the Crash SDK.

Edit the Podfile to add pod dependencies of HUAWEI Analytics and the Crash SDK.

target 'demo' do
# Pods for demo
pod 'HiAnalytics'
pod 'AGConnectCrash'
end
end

2) Install the pod and open the*.xcworkspace file to view the project.

pod install

7. Initialize the AppGallery Connect SDK and Analytics SDK.

Import header files to the AppDelegate.m file of the project and add code for initialization.
#import "AppDelegate.h"
#import <AGConnectCore/AGConnectCore.h>
#import <HiAnalytics/HiAnalytics.h>
[user=2052344]@impl[/user]ementation AppDelegate
- (BOOL)Application:(UIApplication *)Application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after Application launch.
[AGCInstance startup];// Initialization
[HiAnalytics config];// Initialization
return YES;
}
...
[user=994449]@End[/user]

Testing the Crash Service

Create a test button makecrash in your demo project, and tap the button to trigger a crash. You can drag and drop the button for creating it, which is simple. The result is as follows.

Call the testIt method provided by AppGallery Connect to trigger a crash.

In your Xcode simulator, install and run your app, and tap the makecrash button to trigger a crash.

Viewing a Crash Report

1. Sign in to AppGallery Connect, go to My projects, and find the app in which you triggered the crash.

2. Go to Quality > Crash. On the Crash page, click the Statistics tab to view crash statistics of your app. The crash information is displayed just 1 or 2 minutes after you run your app.

3. Click the Problems tab to view the crash of your app. For example, in the following figure, NSRangeException is the crash triggered during the test.

Click the crash to view its details.

Summary:

1、It is easy to integrate the Crash service. During testing, you can either write code yourself, or use the testIt method provided by AppGallery Connect.

2、Crash reports are available in only 1 or 2 minutes.

3、 All you need to write is just a few lines of code during testing. The service integration for app release is coding-free.

4、 The Crash service also provides features including restoring obfuscated reports and generating custom reports.

Reference documents

HUAWEI AppGallery Connect Crash documentation: https://developer.huawei.com/consum...Gallery-connect-Guides/agc-crash-introduction

Coding-free Integration of AppGallery Connect Crash into an Android App:

https://developer.huawei.com/consumer/en/forum/topic/0201387764119030047?fid=0101271690375130218

Codelab of Crash in iOS:

https://developer.huawei.com/consumer/en/codelab/CrashService-iOS/index.html#0