All Products
Search
Document Center

SuperApp:EMASMiniAppService

Last Updated:Mar 04, 2025

The miniapp interface class that provides the main methods for a miniapp.

@protocol EMASMiniAppService <NSObject>

initialize

- (void)initialize:(EMASMiniAppInitConfig *)config;

Initializes a miniapp.

Parameters

config

EMASMiniAppInitConfig: the initialization configurations of the miniapp.

openMiniApp

- (void)openMiniApp:(NSString *)appId openConfiguration:(MiniAppOpenConfiguration *)openConfiguration completionBlock:(void(^)(int resultCode, NSDictionary *resultDict))completionBlock;

Loads a miniapp.

Parameters

appId

NSString: the miniapp ID.

openConfiguration

EMASMiniAppOpenConfiguration: the configurations that are used to start the miniapp.

completionBlock

completionBlock: the callback for loading the miniapp.

previewMiniApp

- (void)previewMiniApp:(NSString *)appId publishId:(NSString *)publishId openConfiguration:(EMASMiniAppOpenConfiguration *)openConfiguration completionBlock:(void(^)(int resultCode, NSDictionary *resultDict))completionBlock;

Generates a preview of a miniapp. You can view the preview by scanning the QR code generated in the EMAS console before you publish the miniapp.

Parameters

appId

NSString: the miniapp ID.

publishId

NSString: the ID of the release ticket. You can obtain the ID from the preview URL.

openConfiguration

EMASMiniAppOpenConfiguration: the configurations that are used to start the miniapp.

completionBlock

completionBlock: the callback for loading the miniapp.

preloadMiniApp

- (void)preloadMiniApp:(NSString *)appId completionBlock:(void(^)(int resultCode, NSDictionary *resultDict))completionBlock;

Download a miniapp resources.

Parameters

appId

NSString: the miniapp ID.

completionBlock

completionBlock: the callback for downloading the miniapp resources.

getMiniAppInfo

- (void)getMiniAppInfo:(NSArray *)appIds completionBlock:(void(^)(int resultCode, NSArray * miniApps))completionBlock;

Queries information about the specified miniapps.

Parameters

appIds

NSString: the IDs of miniapps that you want to query.

completionBlock

completionBlock: the callback method.

queryMiniApps

- (void)queryMiniApps:(NSString *)keyword anchor:(NSString *)anchor completionBlock:(void(^)(int resultCode, NSArray * miniApps, NSString *anchor))completionBlock;

Searches for miniapps from the cursor position. By default, a maximum of 10 miniapps can be returned at a time. This method is generally used for on-demand loading.

Parameters

keyword

NSString: the search keyword.

anchor

NSString: the cursor used for on-demand loading.

completionBlock

completionBlock: the callback for querying miniapp information.

queryMiniApps

- (void)queryMiniApps:(NSString *)keyword  anchor:(NSString *)anchor limit:(int)limit completionBlock:(void(^)(int resultCode, NSArray * miniApps, NSString *anchor))completionBlock;

Searches for miniapps from the cursor position. This method is generally used for on-demand loading.

Parameters

keyword

NSString: the search keyword.

anchor

NSString: the cursor used for on-demand loading.

limit

int: the maximum number of miniapps to return at a time.

completionBlock

completionBlock: the callback for querying miniapp information.

getMiniAppList

- (void)getMiniAppList:(NSString *)anchor completionBlock:(void(^)(int resultCode, NSArray * miniApps, NSString *anchor))completionBlock;

Returns a list of miniapps. By default, a maximum of 10 miniapps can be returned at a time. This method is generally used for on-demand loading.

Parameters

anchor

NSString: the cursor used for on-demand loading.

completionBlock

completionBlock: the callback for querying miniapp information.

getMiniAppList

- (void)getMiniAppList:(NSString *)anchor limit:(int)limit completionBlock:(void(^)(int resultCode, NSArray * miniApps, NSString *anchor))completionBlock;

Returns a list of miniapps. This method is generally used for on-demand loading.

Parameters

anchor

NSString: the cursor used for on-demand loading.

limit

int: the maximum number of miniapps to return at a time.

completionBlock

completionBlock: the callback for querying miniapp information.

updatePopAuthInfo

- (void)updatePopAuthInfo:(NSDictionary *)dic;

Update the description of user device information authorization.

Parameters

dic

NSDictionary: pop-up window displays authorization information

Example:{"location": "Apply for your location information" },scope corresponding value

closeMiniApp

//windvane miniapp close callback, notification close event needs to be handled
- (void)closeMiniApp:(void(^)(NSString *appId))completionBlock;

The callback of closing windvane miniapp.

Parameters

completionBlock

completionBlock: Callback method.