All Products
Search
Document Center

Mobile Platform as a Service:Integrate by using CocoaPods based on the existing project

Last Updated:Nov 20, 2024

This section describes how to generate configurations based on the native plug-in extension mechanism of CocoaPods to quickly integrate mPaaS.

Prerequisites

  • CocoaPods 1.0.0 or a later version has been installed. The project to be connected is the CocoaPods project.

  • The CocoaPods mPaaS plug-in has been installed. If the plug-in has not been installed, run the following command to install it.

    sh <(curl -s http://mpaas-ios.oss-cn-hangzhou.aliyuncs.com/cocoapods/installmPaaSCocoaPodsPlugin.sh)
  • An application has been created in the console, and the .config configuration file has been downloaded. For more information, see Create an application in the console.

Procedure

  1. Copy the .config configuration file to the root directory (at the same level with Podfile) of the project.

    Note

    Please ensure the .config file’s filename is ending with iOS. If it is ending with ios, it needs to be updated to iOS manually.

  2. Run the pod mpaas init command to automatically process the Podfile file and add plugin, source, and mPaaS_baseline configurations. The code for automatic configuration is as follows:

     plugin "cocoapods-mPaaS"
     source 'https://gitee.com/mpaas/podspecs.git'
     mPaaS_baseline 'x.x.x'
  3. Configure the Podfile file.

    1. Modify mPaaS_baseline to specify the mPaaS baseline.

      For example, in mPaaS_baseline '10.2.3', 10.2.3 is the baseline version. For version differences, see Release Note.

    2. Use mPaaS_pod to add mPaaS component dependencies.

      For example, in mPaaS_pod "mPaaS_Nebula", mPaaS_Nebula is a component name. The following table shows more component names.

      Component Configuration

      Applicable Baseline

      Description

      mPaaS_pod "mPaaS_LocalLog"

      10.1.32+

      Local log.

      mPaaS_pod "mPaaS_Log"

      10.1.32+

      Mobile analysis: behavior log, automation log, Crash log, and performance log analysis.

      mPaaS_pod "mPaaS_Diagnosis"

      10.1.32+

      Diagnosis: Client diagnosis and analysis.

      mPaaS_pod "mPaaS_RPC"

      10.1.32+

      Mobile gateway: provides download, upload, RPC call and other functions.

      mPaaS_pod "mPaaS_Sync"

      10.1.32+

      Mobile synchronization: long connection service.

      mPaaS_pod "mPaaS_Push"

      10.1.32+

      Message push.

      mPaaS_pod "mPaaS_Config"

      10.1.32+

      Switch configuration: pull the corresponding value from the server based on the key to dynamically control the client logic.

      mPaaS_pod "mPaaS_Upgrade"

      10.1.32+

      Upgrade release: provides convenient service to proactively detect and upgrade, which can be used for daily phased release and online new version update reminder.

      mPaaS_pod "mPaaS_Share"

      10.1.32+

      Sharing: supports sharing text and pictures to well-known channels such as Weibo, DingTalk, and Alipay friends.

      mPaaS_pod "mPaaS_Nebula"

      10.1.32+

      HTML5 container and offline package: Nebula container, which supports interaction between the front end and the native.

      mPaaS_pod "mPaaS_UTDID"

      10.1.32+

      Device ID: easily and quickly obtained for the application to find a specific device safely and effectively.

      mPaaS_pod "mPaaS_DataCenter"

      10.1.32+

      Unified storage: provides secure, fast, encryptable KV storage that supports multiple data types. The database DAO supports multiple solutions for persistent data storage.

      mPaaS_pod "mPaaS_ScanCode"

      10.1.32+

      Code scan: quickly identifies QR codes and barcodes.

      mPaaS_pod "mPaaS_LBS"

      10.1.32+

      Mobile positioning: positioning solution for mobile clients.

      mPaaS_pod "mPaaS_CommonUI"

      10.1.32+

      Universal UI: universal UI component library that provides various UI components.

      mPaaS_pod "mPaaS_BadgeService"

      10.1.32+

      Badge: badge reminder component of the client, which supports reminder styles such as badge, number, and New. It can automatically manage the badge relationship of a tree structure.

      mPaaS_pod "mPaaS_AlipaySDK"

      10.1.32+

      Quick Pay function of Alipay: quick payment platform of Alipay.

      mPaaS_pod "mPaaS_Multimedia"

      10.1.32+

      Multimedia component: supports image download, upload, cache and other functions.

      mPaaS_pod "mPaaS_MobileFramework"

      10.1.32+

      Mobile framework: client application framework, sub-app management, multi-tab application management, third-party redirection management, viewController redirection, and exception handling and reporting.

      mPaaS_pod "mPaaS_OpenSSL"

      10.1.32+

      OpenSSL

      mPaaS_pod "mPaaS_TinyApp"

      10.1.32+

      Applets: integrates lease capabilities.

      mPaaS_pod "MPBaseTest"

      10.1.32+

      Basic test: basic test module.

      mPaaS_pod "mPaaS_CDP"

      10.1.32+

      Intelligent delivery: configure various intelligent advertisements and presentations to the clients with dynamic launches.

      mPaaS_pod "mPaaS_AliAccount"

      10.1.60+

      Mini program: publish the mini program

      mPaaS_pod "mPaaS_ARTVC"

      10.1.68

      Voice call and video call: Voice call and video call components. This feature supports two-party video calls, group video calls and online conferences.

      mPaaS_pod "mPaaS_BlueShield"

      10.2.3+

      Blue Shield encryption component: Add the absBase64Code parameter in the config file to automatically generate a Blue Shield image.

      mPaaS_pod "mPaaS_MDC"

      10.2.3+

      Mobile Dispatch component: Fine-grained domain name strategic scheduling.

      See the following example of complete Podfile:

      image.png

  4. Execute pod mpaas update x.x.x in the command line, x.x.x is the version number of configured baseline, such as 10.2.3.

  5. Execute pod install to complete integration. You can also add --verbose to view log details.

    Note

    If you are prompted when you execute pod install that you cannot find the library imported from GitHub’s official website, specify the source address for the official GitHub Source at the beginning of podfile: https://github.com/CocoaPods/Specs.git.

  6. If you find the third-party library conflicts after accessing it, you can remove the specific third-party library. For the specific operation, see iOS conflict processing.

Upgrading instructions

When a new version of mPaaS is published, you can select the upgrading components, or the general upgrading baseline (namely SDK version).

Upgrading components

  1. When you execute pod mpaas update x.x.x in the command line, x.x.x is the baseline version number currently in use, such as 10.2.3.

    Screenshot 2023-06-19 at 7.png

  2. Execute pod install to complete upgrading for the corresponding components under this baseline.

Upgrade the baseline

  1. In podfile , modify the corresponding baseline number of mPaaS_baseline to complete upgrading for the general baseline. For example, you can modify the baseline number from 10.1.68 to 10.2.3. The baseline number supports the standard or custom baseline.

    image.png

  2. Execute pod install to complete baseline upgrading.

mPaaS iOS podspec address switch

Background

The original podspec storage warehouse code.aliyun.com used by mPaaS has ceased service (updates will cease on June 1, 2023, and services will cease on June 30, 2023).

Continuing to use the original repo will have the following impacts:

  1. When using the mPaaS pod plugin for SDK update, the latest version of each baseline cannot be pulled;

  2. After 2023.06.30, using the mPaaS pod plugin cannot pull to any baseline version.

Currently mPaaS has supported all mPaaS versions on gitee.com.

Solutions

Upgrade mPaaS pod plugin

Execute 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 execution is complete, execute the pod plugins installed command in the terminal to check the version of cocoapods-mPaaS. If it shows 0.9.6 or above, the upgrade is successful.

up.png

Modify the source configuration in podfile

Replace the originsource "https://code.aliyun.com/mpaas-public/podspecs.git"in podfile with

source "https://gitee.com/mpaas/podspecs.git".

API change

This modification only involves the change of the plugin, and there is no change in the use of plugin commands.

Test validation

After completing the above upgrade and modification configuration operations, you can continue to execute the mPaaS pod plugin related pull command to test whether the latest baseline version and SDK can be pulled.

Parameter list

You can change some default behaviors of the plug-in by configuring parameters.

Usage:

Add parameters in the back end of the plugin "cocoapods-mPaaS". See the following examples:

image.png

Parameters

Function

Applicable versions

:guard_image_version => 6

Generate V6 guard image

≥ V0.9.6

:guard_image_version => 5

Generate V5 guard image

≥ V0.9.6

:only_frameworks => true

In some scenarios (such as the independent framework project), you do not need to add directory files with mPaaS template.

≥ V0.9.5.0.0.2

:check_repo => false

In some cases (such as using an intranet proxy), the default added repo is not automatically checked.

≥ V0.9.5.0.0.2

Note

10.2.3 The baseline version does not need to set :guard_image_version, and generates V6 images by default.

Command list

After installing the cocoapods-mPaaS plug-in, you can use command line tools to assist your development.

Command

Function

pod mpaas init

In Podfile, add plugin, source and mPaaS_baseline.

pod mpaas update <VERSION>

Upgrade the baseline. The parameter <VERSION> is the specific baseline number such as 10.2.3. Then upgrade the podspec library.

pod mpaas update --all

In the official version of the plug-in, this command will upgrade the plug-in, and run the installation script again.

In the beta version of the plug-in, this command will implement features of the official version, and upgrade the local baseline.

pod mpaas info

Show the complete information of the baseline and the corresponding component.

pod mpaas info <NAME> <VERSION>

, in which <VERSION> is optional.

Filter the information about a module name.

pod mpaas info --only-mPaaS

Show some default baseline information, which is easy to be pasted to Podfile.

pod mpaas open

Directly open the . xcworkspace file from the command line.

pod mpaas version

Show the complete baseline used in the current project.

pod mpaas version --plugin

Show the version number of the current cocoapods-mPaaS plug-in.