All Products
Search
Document Center

Mobile Platform as a Service:Integrate with iOS

Last Updated:Jun 23, 2026

H5 mini games support three integration methods: based on the mPaaS framework, into an existing project using the mPaaS plugin, and into an existing project using CocoaPods.

Prerequisites

Add the SDK

H5 mini games require custom baseline version cp_change_56100909. Add the SDK based on your integration method.

  • Use the mPaaS Xcode Extension.

    Use this method if you integrated based on the mPaaS framework or into an existing project using the mPaaS plugin.

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

    2. Select Ariver Mini Program, save the configuration, and then click Start Editing to complete the process.

  • Use the cocoapods-mPaaS plugin.

    Use this method if you integrated into an existing project using CocoaPods.

    1. In the Podfile file, specify the baseline number as cp_change_56100909 and use mPaaS_pod "mPaaS_Ariver" to add the H5 mini game component dependency.

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

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

Initialization and configuration

Initialize the mPaaS framework

If the app lifecycle is not managed by the mPaaS framework and instead uses a custom delegate as shown in the following figure, you must manually initialize the mPaaS framework.

Note

When the app delegate is set to DFClientDelegate, the mPaaS framework manages the app lifecycle automatically. In this case, manual initialization is not required.

image.png

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

    image.png

  2. In the DTFrameworkInterface category, override the shouldInheritDFNavigationController method and return NO. This prevents the navigation controller from inheriting from DFNavigationController.

    image.png

  3. If your app has multiple navigation bars and you need to open mini games in them, you must reset the container's navigation bar after you switch between navigation bars.

    image.png

Initialize the container

To start a mini game, initialize the container by calling the SDK interface after the app launches. Perform the initialization in the - (void)application:(UIApplication *)application beforeDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions method of DTFrameworkInterface.

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

Notes

In baseline cp_change_56100909, if you use the managed mode of the mPaaS framework with a privacy pop-up and set the configuration delegate by using [MPNebulaAdapterInterface shareInstance].configDelegate = self;, you must also set the delegate in the following two methods. Skip this step if you do not use the configuration delegate.

image.png

image.png

Game configuration and startup

Account authorization

Add the following code to the initialization configuration:

#import <AriverMPNebulaAdapter/MPNebulaGameInterface.h>

- (void)application:(UIApplication *)application beforeDidFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{

    // Initialize the container
    [MPNebulaAdapterInterface initNebula];
     // Enable     
    [MPNebulaGameInterface shareInstance].shouldSupportGameJsBridge = YES;
     // Set the callback delegate
    [MPNebulaGameInterface shareInstance].gameDelegate = self;
     

}


#pragma mark----MPNebulaAdapterInterfaceGameProtocol

/*
 jsapi: implementation of getUserInfo
 data: parameters passed from H5 to native
 context: H5 container context
 callback: callback from native to H5, for example, @{@"userId":@"xxx",@"name":@"xxx"}
 */
- (void)getUserInfoHandler:(NSDictionary *)data context:(id)context callback:(void (^)(id res))callback
{
    NSLog(@"MPJsApi4GameGetUserInfo : %@",data);
    if (callback) {
        callback(@{@"userId":@"123456",@"name":@"jack"});
    }
}

/*
 jsapi: implementation of showRewardAd
 data: parameters passed from H5 to native
 context: H5 container context
 callback: callback from native to H5, for example, @{@"key1":@"value1",@"key2":@"value2"}
 */
- (void)showRewardAdHandler:(NSDictionary *)data context:(id)context callback:(void (^)(id))callback
{
    NSLog(@"showRewardAdHandler : %@",data);
}

Ads

/**
 *  Call a JS function on an H5 page from native code.
 *
 *  @param data        Function parameters, for example, @{@"detail":@{@"action":@"onAdShow, onAdReward, or onAdClosed"}}
 *  @param webVC       The H5WebViewController. Get it using (H5WebViewController *)context.currentViewController.
 *  @param callback    The callback block that is processed after the JS side finishes execution.
 */
- (void)callHandlerData:(id)data webViewController:(UIViewController *)webVC
   responseCallback:(void(^)(id resData))responseCallback;




Pass parameters for the call: @{@"action":@"onAdShow"}, @{@"action":@"onAdClosed"}, or @{@"action":@"onAdReward"}

 [[MPNebulaGameInterface shareInstance] callHandlerData:@{@"action":@"onAdShow"} webViewController:self  responseCallback:^(id  _Nonnull resData) {
            
        }];

Start the game

// Online H5 game:
[[MPNebulaAdapterInterface shareInstance] startH5ViewControllerWithParams:@{@"url":@"https://m.hellobike.com/AppGameCenterH5/latest/pr_outIndex_outHome.html#/outHome"}];


// Offline game by ID:
 [[MPNebulaAdapterInterface shareInstance] startH5ViewControllerWithNebulaApp:@{@"appId":@"xxxx"}];