All Products
Search
Document Center

Mobile Platform as a Service:Quick start

Last Updated:Apr 07, 2025

Prerequisites

You have connected the project to mPaaS. Related topics:

Add an SDK

Select an add method based on your integration method.

  • Use mPaaS Xcode Extension This method is applicable to mPaaS-based integration or existing projects that use mPaaS plug-ins.

    1. Click the Xcode menu item Editor > mPaaS > Edit Project to open the Edit Project page.

    2. Select Ariver mini program and click Edit.

  • Use cocoapods-mPaaS plug-ins This method is applicable to the integration mode that uses CocoaPods based on existing projects.

    1. In the Podfile file, specify the baseline number as cp_change_15200851 and use the mPaaS_pod "mPaaS_Ariver" to add the dependency of the Ariver mini program component.

      image.png

    2. Run the pod mpaas update cp_change_15200851 command to update the baseline.

    3. Run pod install on the command line to complete the connection.

The following section describes how to use a mini program based on the official demo of the mini program. The whole process is divided into the following three steps:

  1. Initialize the SDK

  2. Release Miniapp

  3. Start mini program

Initialize the SDK

Initialize the mPaaS framework

If the lifecycle of the app is not managed by the mPaaS framework, but is specified as a delegate defined by yourself, as shown in the following figure, you must manually initialize the mPaaS framework.

Note

mPaaS framework hosting means that the app's delegate is set to DFClientDelegate. In this case, you do not need to manually initialize the mPaaS framework.

image.png

  1. After the window and navigationController of the application are created, call the following method to initialize the mPaaS framework.

    image

  2. Overriding the shouldInheritDFNavigationController method in a DTFrameworkInterface category and returning a NO, the support navigation bar controller may not inherit the DFNavigationController.

    image.png

  3. If an app has multiple navigation bars and you need to open different mini programs in different navigation bars, you must reset the navigation bar of the container after you switch the navigation bar.

    image

Init Containers

To correctly start the mini program, you need to call the SDK interface to initialize the container after the app is started. Must be initialized in a DTFrameworkInterface- (void)application:(UIApplication *)application beforeDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions.

- (void)application:(UIApplication *)application beforeDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Initialize the container.
    [MPNebulaAdapterInterface initNebula];
}

Precautions

In the cp_change_15200851 baseline, if the hosting mode and privacy pop-up box of the mPaaS framework is used and the switch configuration agent [MPNebulaAdapterInterface shareInstance].configDelegate = self; is set, you need to set the switch proxy in the following two methods at the same time; if the switch configuration agent is not set, please ignore it.

image

image

Release mini program

Before starting the mini program, you need to release the mini program in the mPaaS console. The steps are as follows:

  1. Enter the background of the mini program. Log on to the mPaaS console. In the left-side navigation pane, choose Mini Program > Release.

  2. Configure the virtual domain name. If this is the first time you configure a virtual domain name, you must first configure a virtual domain name in the Mini Program > Mini Program Release > Configuration Management. The virtual domain name must be hung under the enterprise domain name to prevent it from being hijacked by third parties, such as example.com.

  3. Create a mini program. Go to the mPaaS console and perform the following operations:

    1. In the left-side navigation pane, choose Mini Program > Mini Program Release.

    2. On the page that appears, click Create.

    3. In the Create Mini Program dialog box, enter the ID and name of the mini program and click OK. The mini program ID is any 16-bit number, for example, 2018080616290001.

    4. In the mini app list, find the new mini app and click Add.

    5. In the Basic Information section, configure the following information:

      • Version: Enter the version number of the small package, for example, 1.0.0.0.

      • Client Range: Select the minimum and maximum versions of the iOS client corresponding to the mini program app. The client App within this range can start the corresponding small program, otherwise it cannot be started. Here, the minimum version can be filled in 0.0.0, and the maximum version can be left unfilled, which means that all versions of the client can start this mini program.

        Note

        The version number here refers to the version number of the current client app. For more information, see the Product Version field in the project Info.plist.

        image.png

      • Icon: Click the Select File icon to upload the small package. You must upload the icon when you create the mini program for the first time. An example icon is as follows:

        image.png

      • Upload the small package resource file in the .zip format. We have prepared a small mPaaS sample program (click here to download ), which can be uploaded directly.

        Note

        Before you upload the mini program, you must change the .zip file name and folder name in the package to the 16-digit ID of the mini program.

    6. In the configuration information bar, complete the following configurations:

      • Main Portal URL: required. The homepage of the mini program. The format of the main entry URL is: /index.html#xxx/xxx/xxx/xxx, where the xxx/xxx/xxx/xxx after# is the first value in the pages in the app.json of the mini program. The main entry point of the mPaaS mini program is: /index.html#page/tabBar/component/index.

      • Keep the default settings for other configurations.

    7. Select the Confirm that the preceding information is accurate and do not modify it after you submit it check box.

    8. Click Submit.

  4. Release the mini program. Go to the mPaaS console and complete the following steps:

    1. In the left-side navigation pane, choose Mini Program > Mini Program Release > Official Mini Program Package Management.

    2. On the Small Packages page, select the small package and version that you want to release, and click Create Release.

    3. In the Create Release panel, configure the following settings:

      • Release Type: Select Official.

      • Release Description: Optional.

    4. Click OK to create the release.

Start mini program

After you complete the preceding steps, run the following code to start the sample mini program in the iOS project:

[MPNebulaAdapterInterface startTinyAppWithId:@"2018080616290001" params:nil];
Note

The 2018080616290001 in the above code is the ID of the mini program. This is only an example in this article. Enter the ID of your mini program.