All Products
Search
Document Center

Simple Log Service:Collect user experience monitoring data from iOS devices

Last Updated:Nov 27, 2023

This topic describes how to collect user experience monitoring data from iOS devices to the Full-stack Observability application.

Prerequisites

A Full-stack Observability instance or trace instance is created. A Full-stack Observability instance is recommended. For more information, see Create an instance and Create a trace instance.

Important
  • Make sure that the version of the Full-stack Observability instance is 2.1.0 or later. You can view the version information in the instance list.

  • In this topic, a Full-stack Observability application is used, and monitoring data is collected to a Full-stack Observability instance.

Step 1: Integrate an SDK

In your project folder, create a Podfile and configure the following settings in the Podfile:

# Specify a source. 
source 'https://gitee.com/aliyun-sls/Specs.git'

# Add the following pods: 
pod 'AliyunLogProducer', '4.0.0'
pod 'AliyunLogOTelCommon', '4.0.0'
pod 'AliyunLogOtlpExporter', '4.0.0'
pod 'AliyunLogCrashReporter', '4.0.0'

Step 2: Initialize the SDK

Initialize the SDK based on the following sample code:

    [ConfigurationManager.shared setProviderWithAccessKeyProvider:^AccessKey * _Nullable(NSString * _Nonnull scope) {
        return [AccessKey initWithAccessKeyId:@"${access-key-id}"
                              accessKeySecret:@"${access-key-secret}"
                        accessKeySecuritToken:@"${access-key-token}"
        ];
    } workspaceProvider:^Workspace * _Nullable(NSString * _Nonnull scope) {
        return [Workspace initWithEndpoint:@"https://${endpoint}"
                                   project:@"${project}"
                                instanceId:@"${instanceId}"
        ];
    } environmentProvider:^Environment * _Nullable(NSString * _Nonnull scope) {
        // Configure the environment information. 
        return [Environment initWithEnv:@"default" // The default value is default. In most cases, we recommend you set this parameter to dev if you use the debug version and to pub if you use the release version. 
                                    uid:@"123456780" // The user ID. This parameter is optional. 
                                  utdid:@"" // The device ID. This parameter is optional. If you specify an invalid value, the SDK automatically generates a valid value. 
                                channel:@"" // The channel. This parameter is optional. 
               ];
    }];

    // In most cases, we recommend that you set this parameter to YES if you use the debug version and to NO if you use the release version. 
    BOOL debuggable = NO;
    [[CrashReporter shared] initWithDebuggable:debuggable];

Variables

Variable

Description

Example

${endpoint}

The endpoint of the Simple Log Service project. Specify an endpoint in the ${region-endpoint} format. You can access Simple Log Service by using a public or internal endpoint. A public endpoint can be accessed over the Internet. An internal endpoint can be accessed over the classic network or a virtual private cloud (VPC). For more information, see Endpoints.

cn-hangzhou.log.aliyuncs.com

${project}

The name of the Simple Log Service project.

test-project

${instance}

The ID of the Full-stack Observability instance. For more information, see Create an instance.

test-traces

${access-key-id}

The AccessKey ID of your Alibaba Cloud account.

We recommend that you use the AccessKey pair of a Resource Access Management (RAM) user that has only the write permissions on the Simple Log Service project. An AccessKey pair consists of an AccessKey ID and an AccessKey secret. For more information about how to grant the write permissions on a specified project to a RAM user, see Use custom policies to grant permissions to a RAM user. For more information about how to obtain an AccessKey pair, see AccessKey pair.

None

${access-key-secret}

The AccessKey secret of your Alibaba Cloud account.

We recommend that you use the AccessKey pair of a RAM user that has only the write permissions on the Simple Log Service project.

None

${access-key-token}

The AccessKey token of your Alibaba Cloud account.

This variable is required only when the AccessKey pair is obtained by calling an Security Token Service (STS) operation.