All Products
Search
Document Center

Access based on native framework and using Cocoapods

Last Updated: Mar 17, 2021

This section describes how to generate configurations based on the native plug-in extension mechanism of CocoaPods to quickly access 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.

    1. 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.
    config

  2. Run the pod mpaas init command to automatically process the Podfile file and add plugin, source, and mPaaS_baseline configurations.
    pod mpaas init

    The code for automatic configuration is as follows:

    1. plugin "cocoapods-mPaaS"
    2. source "https://code.aliyun.com/mpaas-public/podspecs.git"
    3. mPaaS_baseline 'x.x.x'
    Note: You need to replace “x.x.x” in the code with the actual baseline version.
  3. Configure the Podfile file.

    1. Modify mPaaS_baseline to specify the mPaaS baseline.
      For example, in mPaaS_baseline '10.1.32', 10.1.32 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 ConfigurationApplicable BaselineDescription
      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_Hotpatch"10.1.32+Hotpatch: used to fix online bugs without releasing a new version.
      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+H5 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.68Voice call and video call: Voice call and video call components. This feature supports two-party video calls, group video calls and online conferences.

      See the following example of complete Podfile:
       Podfile

  4. Execute pod install to complete access. 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 in podfile: https://github.com/CocoaPods/Specs.git.
  5. If you find the third-party library conflicts after accessing, you can remove the specific third-party library. For the specific operation, see iOS conflict processing.

Upgrading instructions

When the new version of mPaaS 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.1.32.
    upgrade component
  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.32 to 10.1.60. The baseline number supports the standard or custom baseline.
    upgrade baseline
  2. Execute pod install to complete baseline upgrading.

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:

add-param

Parameters Function Applicable versions
: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

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.1.32. 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. For example, pod mpaas info hotpatch 10.1.32.
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.