Add the SDK

Updated at:

This topic describes how to add the Mobile Analysis component to an iOS client. Mobile Analysis supports three connection types: based on the mPaaS framework, from an existing project using the mPaaS plugin, and from an existing project using CocoaPods. For more information, see Connection types. Select the appropriate connection type for your project.

Prerequisites

Connect your project to mPaaS. For more information, see the following topics:

Add the SDK

Select an approach to add the SDK based on your connection type.

Use the mPaaS Xcode Extension

This method applies if you connect based on the mPaaS framework or from an existing project using the mPaaS plugin.

  1. In the Xcode menu, click Editor > mPaaS > Edit Project to open the project editing page.

  2. Select Mobile Analysis, save the settings, and then click Start Editing to add the component.

  3. In your project, go to Build Settings > Header Search Paths and add the search path for the system library: /usr/include/libxml2.

  4. After you add the SDK, the corresponding framework appears in the mPaaS/Frameworks folder of your project. The following table describes the frameworks.

    Library

    Framework

    Description

    Instrumentation

    MPRemoteLogging

    Records logs for events that are triggered when the program runs to a specific point.

    Automatic instrumentation

    MPAutoTracker

    Automatically monitors user gestures by hooking UI components. It also automatically monitors events such as application interface switches.

    Performance instrumentation

    MPPerformance

    Provides monitoring data for app memory, power consumption, and traffic.

    Crash report

    APCrashReporter

    Collects, desymbolicates, and categorizes crash logs. It provides analysis tools for developers to resolve crashes and improve application stability.

    Interface layer

    MPMasAdapter

    An interface library that encapsulates logs for keep-alive reports, startup speed, power consumption, and crash reports. For applications that do not use the mPaaS iOS framework, you must manually invoke the interface methods to view the related data in the Mobile Analysis console.

    SDK versions 10.1.32 and later provide the MPMasAdapter middle layer to unify and simplify interface calls. For more information about the interfaces, see MPRemoteLoggingInterface.h and MPAnalysisHelper.h in the framework.

Use the cocoapods-mPaaS plugin

This method applies if you connect from an existing project using CocoaPods.

  1. In the Podfile, add the dependency for the Mobile Analysis component: mPaaS_pod "mPaaS_Log".

  2. Run pod install to complete the connection.

What to do next

To use the SDK, refer to the documentation for your specific SDK version.