tencent cloud

Feedback

Mini Program Management API

Last updated: 2024-03-04 22:58:36

    Open the Mini Program

    Launch the Standard Mini Program

    Upon launching the Mini Program, the system first checks whether there is a cache of the Mini Program locally.
    If the cache is not available, the system will automatically download the Mini Program from the remote server and then launch it.
    If the cached Mini Program exists, it will be launched first, and the backend verification server will check if a new version of the Mini Program is available.
    Note:
    Should a newer version be available, the system will download the updated Mini Program. Consequently, the next time the Mini Program is launched, the updated version will be utilized.
    /// Launch the Mini Program via its ID.
    /// @param appID: Mini Program ID
    /// @param scene: Scene value
    /// @param firstPage: Open page
    /// @param paramsStr: Pass in parameters
    /// @param parentVC: From which VC the call starts
    /// /// @param completion: Error callback
    - (void)startUpMiniAppWithAppID:(NSString *)appID
    scene:(TMAEntryScene)scene
    firstPage:(NSString * _Nullable)firstPage
    paramsStr:(NSString * _Nullable)paramsStr
    parentVC:(UIViewController *)parentVC
    completion:(void (^)(NSError * _Nullable))completion;
    Options: List of supported parameters
    Name
    Mandatory
    Type
    Effect
    appID
    YES
    NSString
    Open the designated Mini Program's ID.
    scene
    YES
    TMAEntryScene
    Scene value used to open the Mini Program.
    firstPage
    NO
    NSString
    Open the page.
    paramsStr
    NO
    NSString
    Open the passed parameters.
    parentVC
    YES
    UIViewController
    From which VC the call starts
    completion
    YES
    block
    Error Callback

    Launch the Mini Program via QR Code.

    TCMPP supports launching the Mini Program by recognizing the content of the QR code.
    /// Launch the Mini Program via QR Code.
    /// @param qrData: QR code content
    /// @param parentVC: From which VC the call starts
    /// /// @param completion: Error callback
    - (void)startUpMiniAppWithQrData:(NSString *)qrData
    parentVC:(UIViewController *)parentVC
    completion:(void (^)(NSError * _Nullable error))completion;

    Close the Mini Program.

    /// Terminate all Mini Programs currently running in memory.
    
    - (void)closeAllApplications;

    Clear cache

    The operation of the Mini Program will cache the Mini Program package and its information locally, facilitating a quicker launch in subsequent uses. If you wish to erase all information related to the Mini Program, you can invoke the following API to delete a specific Mini Program or to purge all Mini Programs.
    /// Remove all related caches of the Mini Program, including resource packages, basic libraries, and Mini Program/Mini Game sandbox data.
    - (void)clearMiniAppCache;

    Get Mini Program Information

    Get information on the currently running Mini Program

    /// Retrieve the Object of the Currently Running Mini Program
    /// @return TMFAppletInfo: Mini Program information
    - (TMFMiniAppInfo *)currentApplet;

    Get information on all recently opened Mini Programs

    // Get information on all recently opened Mini Programs
    ///@return: Array of Mini Programs <TMFMiniAppInfo>
    - (NSArray *)loadAppletsFromCache;

    Search for Mini Programs

    You can search for a list of currently released Mini Programs on the platform using keywords.
    /// Search for Mini Programs
    /// @param name: Keyword for search name
    /// @param completion: Search results
    - (void)searchAppletsWithName:(NSString *)name
    completion:(void (^)(NSArray<TMFAppletSearchInfo *> * _Nullable, NSError * _Nullable))completion;
    
    Contact Us

    Contact our sales team or business advisors to help your business.

    Technical Support

    Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

    7x24 Phone Support