Real User Monitoring (RUM) provides comprehensive monitoring for mobile applications. You can use it to monitor and analyze key metrics in real time, such as application performance, crashes, and stuttering. This topic describes how to integrate an iOS application.
Prerequisites: Create an application
Log on to the Cloud Monitor 2.0 console, and select a workspace. In the left navigation pane, click Integration Center.
In the Frontend Application area, click the iOS card, enter an application name, configure other parameters as needed, and then click Create Application.
NoteThe application name must be unique.
After the application is created, the integration code is generated at the bottom of the page. The code contains key information such as the AppID and Endpoint.
You can find the created application on the page. To view the integration code, go to the application details page and navigate to the page.
The SDK integration parameters changed in version 2.0.0 and are not compatible with earlier versions. If you upgrade to version 2.0.0 or later, you must reintegrate the SDK by following the latest documentation. This ensures that the SDK initializes correctly.
Step 1: Integrate the SDK
Automatic integration with Cocoapods (recommended)
Add the latest version of the SDK to the Podfile in your Xcode project.
source 'https://github.com/CocoaPods/Specs.git' target 'iOSDemo' do # Comment the next line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! # Import the Alibaba Cloud ARMS RUM SDK pod 'AlibabaCloudRUM', '2.1.0' endIn the project's root directory, run the following command to update the Pod environment.
pod install --repo-update
Manual integration
Download the SDK and decompress it.
The .zip file contains the following content:
AlibabaCloudRUM.xcframework
AlibabaCloudRUMSDK.xcframework
Configure the project.
In Xcode, choose . In the dialog box that opens, select the two component packages that you downloaded in the previous step, and click Add.
NoteThe steps may vary slightly depending on the Xcode version.
You can select "Copy files to destination".

In your project settings, go to target > Build Phases > Link Binary With Libraries and add the following dependencies.
libc++.tbd (required)
libresolv.tbd (required)

Go to target > Build Settings, search for Other Linker Flags, and add the
-ObjCcompilation flag.ImportantEnsure that the
-ObjCflag is entered correctly.
Step 3: Import the header file
Import the header file in main.m or AppDelegate.m.
Objective-C
@import AlibabaCloudRUM;Swift
import AlibabaCloudRUMStep 4: Initialization
Initialize the SDK in the main function or the - application:didFinishLaunchingWithOptions: method.
Objective-C
[AlibabaCloudRUM setEndpoint:@"<your endpoint>"];// Obtain the Endpoint when you create the RUM application.
[AlibabaCloudRUM setWorkspace:@"<your workspace>"];// Obtain the Workspace when you create the RUM application.
[AlibabaCloudRUM start:@"<your serviceId>"];// Obtain the ServiceId when you create the RUM application.Swift
AlibabaCloudRUM.setEndpoint("<your endpoint>")// Obtain the Endpoint when you create the RUM application.
AlibabaCloudRUM.setWorkspace("<your workspace>")// Obtain the Workspace when you create the RUM application.
AlibabaCloudRUM.start("<your serviceId>")// Obtain the ServiceId when you create the RUM application.Integration validation
After you run the application, the message "AlibabaCloudRUMSDK init success" in the console indicates that the SDK is initialized successfully. For example:
[AlibabaCloudRUM] [INFO ] [RUM] <start> AlibabaCloud RUM init success