All Products
Search
Document Center

Mobile Platform as a Service:Preview and debug iOS Mini Program on real device

Last Updated:May 14, 2024

This topic describes how to preview and debug a mini program on an iOS client.

Note

The preview and debugging feature of mini programs is supported only in mPaaS 10.1.60 and later.

Follow these steps to access the preview and debugging features:

  1. Obtain the content string based on the QR code of the IDE (for example, by scanning the QR code).

  2. Call the mini program preview and debugging interface.

    • Pass in the QR code content string:

      [MPNebulaAdapterInterface startDebugTinyAppWithUrl:qrCode];
    • or custom parameter interface:

      [MPNebulaAdapterInterface startDebugTinyAppWithUrl:qrCode params:nil];

      If you need to pass parameters when opening the mini program, you can set the parameters by param the parameters. The param contains the page and query fields:

      • page: Specifies the path to a specific page to open.

      • query: specifies custom parameters. Concatenate multiple key-value pairs with ampersand (& ).

        NSDictionary *param = @{@"page":@"pages/card/index", @"query":@"own=1&sign=1&code=2452473"};
        [MPNebulaAdapterInterface startTinyAppWithId:appId params:dic];

Configure a whitelist

When using the real-device preview and debugging function, the client needs to configure the unique user ID in the category of MPaaSInterface. According to the actual situation of the application, returns the unique ID of the App in the userId method, such as user name, mobile phone number, email, etc. The value to be entered in the Whitelist configuration plugin of the Mini Program IDE must be consistent with the userId configured here.

#import <mPaas/MPaaSInterface.h>
@implementation MPaaSInterface (MPTinyAppDemo_pod)

- (NSString *)userId
{
    return @"mPaaS";
}

@end