This topic describes how to use Log Service SDK for iOS to collect logs.

Prerequisites

Log Service SDK for iOS is installed. For more information, see Install Log Service SDK for iOS.

Sample code based on Swift

In the following example, download a source code project from GitHub and create an executable iOS app in the iOS development environment to collect logs from iOS systems.

  1. Download source code files for the app from GitHub.
  2. In the iOS development environment, create a project and import the files.
  3. Open the ViewController.swift file and set the endpoint, AccessKey pair, project, and Logstore based on the Logstore that you want to use.
  4. Run the app.
    The app automatically sends iOS system logs to the specified Logstore.

For more information about sample code, see aliyun-log-ios-sdk.

Sample code based on Objective-C

In the following example, download a source code project from GitHub and create an executable iOS app in the iOS development environment to collect logs from iOS systems.

  1. Download source code files for the app from GitHub.
  2. In the iOS development environment, create a project and import the files.
  3. Open the ViewController.m file and set the endpoint, AccessKey pair, project, and Logstore based on the Logstore that you want to use.
  4. Run the app.
    The app automatically sends iOS system logs to the specified Logstore.

For more information about sample code, see aliyun-log-ios-sdk.