All Products
Search
Document Center

SuperApp:Perform operations on miniapps

Last Updated:Jan 23, 2026

After you integrate the WindVane or uni-app miniapp container into a native app, you can search for miniapps, obtain a list of miniapps, or start a miniapp.

Obtain a list of miniapps

The miniapp container SDK provides an interface for obtaining a list of miniapps. If you only want to obtain the miniapp list, you can directly use this interface.

id<EMASMiniAppService> miniAppService = [[EMASServiceManager sharedInstance] serviceForProtocol:@"EMASMiniAppService"];

if (miniAppService) {
   // The default value of the anchor parameter is 0.
  [miniAppService getMiniAppList:anchor completionBlock:^(int resultCode, NSArray * _Nonnull miniApps, NSString *anchor) {
  	 // If the value of resultCode is 200, all miniapps are obtained.
     // Return a list of miniapps. By default, a maximum of 10 miniapps can be obtained. The anchor parameter is used to obtain more miniapps.
  }];
}

Search for miniapps

The miniapp container SDK provides an interface for searching for miniapps. If you only want to search for miniapps, you can directly use this interface.

id<EMASMiniAppService> miniAppService = [[EMASServiceManager sharedInstance] serviceForProtocol:@"EMASMiniAppService"];

if (miniAppService) {
   // The keyword parameter specifies the search keyword. The default value of the anchor parameter is 0.
  [miniAppService queryMiniApps:keyword anchor:anchor completionBlock:^(int resultCode, NSArray * _Nonnull miniApps, NSString *anchor) {
 		// If the value of resultCode is 200, the search is successful.	
    // Return the search results. By default, a maximum of 10 miniapps can be obtained. The anchor parameter is used to obtain more miniapps.
  }];
}

Start a miniapp

You can start a miniapp by using its ID. WindVane miniapps and uni-app miniapps can be started in the same manner. Loading a miniapp requires a specific period of time. We recommend that you add code to associated callback methods to initialize or update UI elements.

id<EMASMiniAppService> miniAppService = [[EMASServiceManager sharedInstance] serviceForProtocol:@"EMASMiniAppService"];

if (miniAppService) {
   [miniAppService openMiniApp:appId openConfiguration:nil completionBlock:^(int resultCode, NSDictionary * _Nonnull resultDict) {
            
    }];
}

Open a specific page within a miniapp

When you start a miniapp, you can configure the path parameter to open a specific page within the miniapp and use extraData to pass arguments to the page.

Note
  • For a uni-app miniapp, the path parameter specifies the absolute URL of the miniapp page and extraData is a JSON object used to pass startup arguments to the miniapp. After the miniapp is started, you can retrieve values from extraData by using the plus.runtime.arguments method.

  • To open a page within a WindVane miniapp, you can access a URL in the following format: https://{appId}.app.mini.windvane.suite.emas.alibaba.com/index.html#/{path}?key=value&key2=123. When you develop miniapps, you must use hash routing to handle the logic of page navigation.

id<EMASMiniAppService> miniAppService = [[EMASServiceManager sharedInstance] serviceForProtocol:@"EMASMiniAppService"];
    
if (miniAppService) {
    EMASMiniAppOpenConfiguration *config = [[EMASMiniAppOpenConfiguration alloc] init];
    if (path.length > 0) {
        // The deeplink path.
        config.path = path;
    }
    if (params){
        // The extended parameters.
        config.extraData = params;
    }
    
    [miniAppService openMiniApp:self.appId openConfiguration:config completionBlock:^(int resultCode, NSDictionary * _Nonnull resultDict) {
        NSLog(@"resultCode = %d, resultDict = %@",resultCode,resultDict);
        if (resultCode == 200) {
            // If the miniapp is started, you are redirected to the homepage of the miniapp.
        }
    }];
}

Preview a MiniApp

By using the "miniapp ID" and "publishId", you can preview the miniapp. Generally, preview parameters are obtained by scanning the QR Code on an Open Platform, and then the preview is started referring to the following example code.

 //miniappid,P79127424345890****:publishid
- (void)previewMiniApp:(NSString *)miniAppId publishId:(NSString *)publishId miniAppType:(EMASMiniAppType)miniAppType {
    id<EMASMiniAppService> miniAppService = [[EMASServiceManager sharedInstance] serviceForProtocol:@"EMASMiniAppService"];
    if (miniAppService) {
        EMASMiniAppOpenConfiguration *config = [[EMASMiniAppOpenConfiguration alloc] init];
        config.miniAppType = miniAppType;
        [miniAppService previewMiniApp:miniAppId publishId:publishId openConfiguration:config completionBlock:^(int resultCode, NSDictionary * _Nonnull resultDict) {
            
        }];
    }
}

Obtain category list

The miniapp container SDK provides an interface for obtaining a category list of miniapps. If you only want to obtain the miniapp category list, you can directly use this interface.

id<EMASMiniAppService> miniAppService = [[EMASServiceManager sharedInstance] serviceForProtocol:@"EMASMiniAppService"];
    if (miniAppService) {
        [miniAppService queryMiniAppCategories:^(int resultCode, NSArray *resultArray) {
            if (resultCode == 200) {
               //If the value of resultCode is 200, category list are obtained.
            } else {
              //failed
               }
        }];
    }

Obtain miniapp list of the category

The miniapp container SDK provides an interface for obtaining a miniapp list of the category id. If you only want to obtain the miniapp list, you can directly use this interface.

id<EMASMiniAppService> miniAppService = [[EMASServiceManager sharedInstance] serviceForProtocol:@"EMASMiniAppService"];
   if (miniAppService) {
        [miniAppService queryMiniAppsByCategory:categoryId completionBlock:^(int resultCode, NSArray * _Nonnull resultArray) {
            if (resultCode == 200) {
                //If the value of resultCode is 200, miniapp list of the catgory id are obtained.
            } else {
               //failed
            }
        }];
    }

Preload Mini App Package

The mini-app container SDK provides an interface for preloading mini-app package.

Method:

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

Parameters:

Parameter

Type

Description

appId

NSString

Mini app ID

openConfiguration

EMASMiniAppOpenConfiguration

Configuration for the mini app

completionBlock

Callback for preloading results

Usage Example:

#import <EMASServiceManager/EMASServiceManager.h>
#import <EMASMiniAppApi/EMASMiniAppService.h>


- (void)preloadMiniApp:(NSString *)miniAppId {
    id<EMASMiniAppService> miniAppService = [[EMASServiceManager sharedInstance] serviceForProtocol:@"EMASMiniAppService"];
    if (miniAppService) {
        EMASMiniAppOpenConfiguration *config = [[EMASMiniAppOpenConfiguration alloc] init];
        // If you plan to preload the uni mini app, please specify the "EMASMiniAppTypeUniApp" type
//        config.miniAppType = EMASMiniAppTypeUniApp;
        [miniAppService preloadMiniApp:miniAppId openConfiguration:config completionBlock:^(int resultCode, NSDictionary * _Nonnull resultDict) {
            NSLog(@"preloadMiniApp:resultCode:%d\nresultDict:%@", resultCode, resultDict);
        }];
    }
}

Get Cache Information of All Mini apps in the Current Container

Method:

- (NSArray *)getMiniAppPkgInfoList;

Return result:
A list of dictionary objects, where each dictionary contains cache metadata for one mini app. The map includes the following keys:

mini app. The map includes the following keys:

Key

Value Type

Description

mini_app_id

NSString

Mini app ID

mini_app_name

NSString

Mini app name

cache_size

NSString

Size of the cached mini app package (in bytes)

cache_version

NSString

Version of the cached mini app package

create_time

NSString

Creation time of the cached package (format: yyyy-MM-dd HH:mm:ss

)

last_access_time

NSString

Last access time of the cached package (format: yyyy-MM-dd HH:mm:ss

)

preload_pkg_size

NSString

Size of the preloaded package (in bytes)

preload_pkg_version

NSString

Version of the preloaded package

Usage Example:

#import <EMASServiceManager/EMASServiceManager.h>
#import <EMASMiniAppApi/EMASMiniAppService.h>

- (void)getMiniAppCacheInfo {
    id<EMASMiniAppService> miniAppService = [[EMASServiceManager sharedInstance] serviceForProtocol:@"EMASMiniAppService"];
    if (miniAppService) {
        NSArray *caches = [miniAppService getMiniAppPkgInfoList];
        NSLog(@"getMiniAppInfoList:%@", caches);
        
    }
}

Sample Output:

[
    {
        mini_app_id=1512008766390152499200, 
        mini_app_name=AI Search, 
        cache_size=4096, 
        cache_version=0.0.26, 
        create_time=2026-01-21 16:38:54, 
        last_access_time=2026-01-21 16:38:54,
        preload_pkg_size=4096,
        preload_pkg_version=0.0.26
    },
    ...
]

Delete Specified Mini app Caches from the Current Container

Method:

- (BOOL)removeMiniAppPackages:(NSArray<NSString *>*)miniAppIds;

Parameters:

Parameter

Type

Description

miniAppIds

NSArray<NSString *>

List of mini app IDs to delete

Return result:

  • YES: All specified mini app caches were successfully deleted.

  • NO: At least one mini app cache failed to be deleted.

Usage Example:

#import <EMASServiceManager/EMASServiceManager.h>
#import <EMASMiniAppApi/EMASMiniAppService.h>

- (void)removeMiniAppPkgs:(NSArray<NSString *>*)miniAppIds {
    if (miniAppIds && miniAppIds.count > 0) {
        id<EMASMiniAppService> miniAppService = [[EMASServiceManager sharedInstance] serviceForProtocol:@"EMASMiniAppService"];
        if (miniAppService) {
            BOOL isSuccess = [miniAppService removeMiniAppPackages:miniAppIds];
        }
    }
    
}

Mini app Download Statistics

Observer Interface Definition:

@protocol SAIDownloadStatsObserver <NSObject>

- (void)onMiniAppDownloadSuccess:(NSDictionary *)params;
- (void)onMiniAppDownloadFailed:(NSDictionary *)params;

@end

Callback Parameters:

Key

Value Type

Description

mini_app_id

NSString

Mini app ID

mini_app_version

NSString

Mini app version

Usage Example:

#import <EMASMiniAppService/SAIDownloadStatsObserver.h>
#import <EMASServiceManager/EMASServiceManager.h>
#import <EMASMiniAppApi/EMASMiniAppService.h>

- (void)registerObserver {
    id<EMASMiniAppService> miniAppService = [[EMASServiceManager sharedInstance] serviceForProtocol:@"EMASMiniAppService"];
    if (miniAppService) {
        [miniAppService registerServiceObserver:self];
    }
}

- (void)onMiniAppDownloadFailed:(NSDictionary *)params {
    NSLog(@"------onMiniAppDownloadFailed:%@", params);
}

- (void)onMiniAppDownloadSuccess:(NSDictionary *)params {
    NSLog(@"------onMiniAppDownloadSuccess:%@", params);
}

Set the app language obtained by the miniapp

The miniapp container SDK provides an interface for updating the app language when setting/changing the language within the App. After calling this interface, the appLanguage field in the (WindVane) JSAPI WVSystem.getSystemInfo will be updated accordingly.

Note: This interface takes effect only after the miniapp container SDK has been initialized.

[EMASMiniAppPortal.share setAppLanguage:@"XXX"];