This topic describes how to quickly integrate mPaaS by generating configurations using the CocoaPods native plugin extension.
Prerequisites
You have installed CocoaPods 1.0.0 or later. For more information, see CocoaPods. Your project must be a CocoaPods project.
You have installed the Cocoapods-mPaaS plugin. If you have not installed the plugin, run the following command to install it.
sh <(curl -s http://mpaas-ios.oss-cn-hangzhou.aliyuncs.com/cocoapods/installmPaaSCocoaPodsPlugin.sh)You have created an application in the console and downloaded the
.configconfiguration file. For more information, see Create an application in the console.
Integration steps
Copy the
.configconfiguration file to the root directory of your project. This directory is the same as the one that contains thePodfile.NoteEnsure that the downloaded
.configfile name ends withiOS. If it ends withios, you must manually change it toiOS.In the command line, run the
pod mpaas initcommand. This command automatically processes thePodfileand adds theplugin,source, andmPaaS_baselineconfigurations. The automatically configured code is as follows:plugin "cocoapods-mPaaS" source 'https://gitee.com/mpaas/podspecs.git' mPaaS_baseline 'x.x.x'Configure the
Podfilefile.Specify the mPaaS baseline by modifying
mPaaS_baseline. For example,mPaaS_baseline '10.2.3', where10.2.3is the baseline version number. For information about the differences between versions, see Release notes.Add mPaaS component dependencies using
mPaaS_pod. For example,mPaaS_pod "mPaaS_Nebula", wheremPaaS_Nebulais the component name. For a list of component names, see the component list below.Component configuration
Applicable baseline
Description
mPaaS_pod "mPaaS_LocalLog"
10.1.32+
Local log
mPaaS_pod "mPaaS_Log"
10.1.32+
Mobile Analysis Service: Analyzes behavior logs, automated logs, crash logs, and performance logs.
mPaaS_pod "mPaaS_Diagnosis"
10.1.32+
Diagnosis: Client-side diagnostic analysis.
mPaaS_pod "mPaaS_RPC"
10.1.32+
Mobile Gateway Service: Provides features such as download, upload, and remote procedure calls (RPC).
mPaaS_pod "mPaaS_Sync"
10.1.32+
Mobile Sync Service: Persistent connection service.
mPaaS_pod "mPaaS_Push"
10.1.32+
Message Push Service
mPaaS_pod "mPaaS_Config"
10.1.32+
Configuration Switch: Pulls the corresponding value from the server based on a key to dynamically control client logic.
mPaaS_pod "mPaaS_Upgrade"
10.1.32+
Upgrade and release: Provides a service for proactive upgrade checks. Use it for canary releases and online new version notifications.
mPaaS_pod "mPaaS_Share"
10.1.32+
Share: Supports sharing text and images to popular channels such as Weibo, DingTalk, and Alipay friends.
mPaaS_pod "mPaaS_Nebula"
10.1.32+
HTML5 container and offline packages: The Nebula container supports interaction between the frontend and native code.
mPaaS_pod "mPaaS_UTDID"
10.1.32+
Device ID: Quickly obtains a device ID to help applications securely and effectively identify specific devices.
mPaaS_pod "mPaaS_DataCenter"
10.1.32+
Datacenter: Provides secure, fast, and encryptable key-value (KV) storage that supports multiple data types. It also offers various persistence solutions, such as database Data Access Object (DAO) support.
mPaaS_pod "mPaaS_ScanCode"
10.1.32+
Scan Code: Quickly recognizes QR codes and barcodes.
mPaaS_pod "mPaaS_LBS"
10.1.32+
Location Based Service: A location solution for mobile clients.
mPaaS_pod "mPaaS_CommonUI"
10.1.32+
Common UI: A library of common user interface (UI) components.
mPaaS_pod "mPaaS_BadgeService"
10.1.32+
Badge Service: A client-side "red dot" notification component. It supports notification styles such as dots, numbers, and "New". It also automatically manages hierarchical badge relationships.
mPaaS_pod "mPaaS_Multimedia"
10.1.32+
Multimedia component: Supports features such as image download, upload, and caching.
mPaaS_pod "mPaaS_MobileFramework"
10.1.32+
Mobile Framework: A client application framework. It manages sub-apps, multi-tab applications, third-party redirects, viewController transitions, and exception handling and reporting.
mPaaS_pod "mPaaS_OpenSSL"
10.1.32+
OpenSSL
mPaaS_pod "mPaaS_TinyApp"
10.1.32+
Mini Program: Provides the capability to integrate and publish miniapps.
mPaaS_pod "mPaaS_CDP"
10.1.32+
Mobile Content Delivery Platform: Provides intelligent and dynamic delivery of a variety of marketing advertisements and display formats to the client.
mPaaS_pod "mPaaS_ARTVC"
10.1.68
Audio and Video Call: An audio and video call component. It supports two-party and multi-party video calls and online meetings.
mPaaS_pod "mPaaS_BlueShield"
10.2.3+
BlueShield encryption component: Add the absBase64Code parameter to the config file to automatically generate a BlueShield image.
mPaaS_pod "mPaaS_MDC"
10.2.3+
Mobile Dispatch Component (MDC): Fine-grained domain name policy scheduling.
The following shows a complete Podfile example:

Run
pod mpaas update x.x.x, wherex.x.xis the configured baseline number, such as10.2.3.Run
pod installto complete the integration. You can also append--verboseto view detailed logs.NoteIf you receive a message that a library from the official GitHub website cannot be found when you run
pod install, specify the official GitHub source address at the top of your Podfile:https://github.com/CocoaPods/Specs.git.If you encounter third-party library conflicts after the integration, remove the conflicting libraries. For more information, see Handle iOS conflicts.
Upgrade guide
When a new version of mPaaS is released, you can upgrade individual components or the entire baseline, which is the SDK version.
Upgrade components
In the command line, run
pod mpaas update x.x.x, wherex.x.xis the current baseline version number, such as10.2.3.
Run
pod installto upgrade the components for the specified baseline.
Upgrade the baseline
In the
Podfile, change the baseline number formPaaS_baselineto upgrade the entire baseline. For example, you can change10.1.68to10.2.3. Standard and custom baselines are supported.
Run
pod installto complete the baseline upgrade.
Switching the mPaaS iOS podspec address
Background
The mPaaS podspec repository at code.aliyun.com has been discontinued. It stopped receiving updates on June 1, 2023, and the service was terminated on June 30, 2023.
If you continue to use the old repository, you will experience the following issues:
When you update the SDK using the mPaaS pod plugin, you cannot pull the latest baseline versions.
After June 30, 2023, you cannot pull any baseline versions using the mPaaS pod plugin.
All mPaaS versions are now supported on gitee.com.
Solutions
Upgrade the mPaaS pod plugin
Run the following command to update to the latest mPaaS pod plugin:
sh <(curl -s http://mpaas-ios.oss-cn-hangzhou.aliyuncs.com/cocoapods/installmPaaSCocoaPodsPlugin.sh)After the command finishes, run pod plugins installed in the terminal and check the version of cocoapods-mPaaS. The upgrade is successful if the version is 0.9.6 or later.

Modify the source configuration in the podfile
In your Podfile, replace the original source "https://code.aliyun.com/mpaas-public/podspecs.git" with the following:
source "https://gitee.com/mpaas/podspecs.git".
API changes
This modification only involves changes to the plugin. The usage of plugin commands remains unchanged.
Test and verify
After you complete the upgrade and configuration changes, run the mPaaS pod plugin pull commands to test whether you can pull the latest baseline version and SDK.
Parameter list
You can configure parameters to change some of the default behaviors of the plugin.
Procedure:
Add parameters after plugin "cocoapods-mPaaS" in your Podfile. The following shows an example:

Parameter | Feature | Applicable version |
| Generating a V6 Bodyguard image | ≥ V0.9.6 |
| Generate a V5 security image | ≥ V0.9.6 |
| In some scenarios, such as a standalone framework project, you do not need to automatically add the mPaaS template directory files. | ≥ V0.9.5.0.0.2 |
| In some scenarios, such as when using an internal network agent, the default repo is not automatically checked and added. | ≥ V0.9.5.0.0.2 |
For baseline version 10.2.3, you do not need to set :guard_image_version because a V6 image is generated by default.
Command list
After you install the cocoapods-mPaaS plugin, you can use the command line interface (CLI) to assist with your development.
Command | Feature |
| Adds |
| Updates the baseline and the podspec repository. The |
| In the official plugin, this command upgrades the plugin by rerunning the installation script. In the beta plugin, this command also updates the local baseline. |
| Displays complete information about baselines and their corresponding components. |
| Filters information for a specific module name. |
| Displays partial default baseline information for easy one-click pasting into the Podfile. |
| Opens the |
| Displays the full baseline used by the current project. |
| Displays the version number of the current Cocoapods-mPaaS plugin. |