tencent cloud

Feedback

Last updated: 2024-11-21 18:04:20

    Host app APIs

    /**
    * @brief SDK host app name
    * This API is mainly used to indicate the app name.
    */
    - (NSString *)appName;
    
    /**
    * @brief SDK host app version
    * @return A lowercase string, such as 1.0.0, is returned.
    */
    - (NSString *)getAppVersion;
    
    /**
    * @brief The network status of the SDK host app
    */
    
    - (TMANetWorkStatus)getAppNetworkStatus;
    
    /**
    * @brief Model of the SDK host app
    */
    - (NSString *)getAppIPhoneModel;
    
    /**
    * @brief Device information of the SDK host app
    * @return format: {@"brand":@"iPhone",@"model":@"iPhone 11<iPhone12,1>",@"system":@"ios",@"platform":@"iOS 16.4.1"}
    */
    - (NSDictionary *)getAppDeviceInfo;
    /**
    * @brief Obtain basic information of the host app
    * @return Format: {@"SDKVersion":@"2.32.2",@"model":@"iPhone 11<iPhone12,1>",@"system":@"ios",@"platform":@"iOS 16.4.1"}
    */
    - (NSDictionary *)getAppBaseInfo;
    
    /**
    * @brief Obtain current language set by the host app
    * @return Format: "zh-Hans"
    */
    - (NSString *)getCurrentLocalLanguage;
    
    
    /**
    * @brief The current theme set by the host app. If it is not implemented via this API, the value returned in getAppBaseInfo is the system theme.
    */
    - (NSString *)getAppTheme;
    
    /**
    * @brief Clipboard frequency control
    */
    - (NSNumber *)getClipboardInterval;
    
    // The maximum number of mini programs kept alive. Default value: 3
    
    
    - (NSInteger)maxMiniAppKeepAliveCount;
    
    
    // Set the host to open the applet URL Scheme
    - (NSString *)getAppScheme;

    Screen capture, screen recording and watermarking

    - (void)applet:(TMFMiniAppInfo *)appletInfo screenCaptureStatusChanged:(BOOL)isCapture atPagePath:(NSString *)pagePath;
    
    - (void)appletDidTakeScreenshot:(TMFMiniAppInfo *)appletInfo atPagePath:(NSString *)pagePath;
    
    - (nullable UIView *)appletCustomizeWatermarkView:(TMFMiniAppInfo *)appletInfo;

    Process special URLs in web-view component

    Special URLs in web-view component pages should be passed to the host app for processing.
    // Triggered when redirecting to non-http/https in the web-view component. It is used to process special URLs in the web-view component, such as opening other apps.
    // @param app {TMFMiniAppInfo} Information of the mini-program to which the web-view component belongs
    // @param url {NSURL} The URL to be accessed
    // @return Whether to intercept
    - (BOOL)webViewCustomUrlLoading:(TMFMiniAppInfo *)app url:(NSURL *)url {
    NSLog(@"webViewCustomUrlLoading:%@,appid:%@",[url absoluteString],app.appId);
    if ([[UIApplication sharedApplication] canOpenURL:url]) {
    if (@available(iOS 10.0, *)) {
    [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
    if (success) {
    NSLog(@"webViewCustomUrlLoading:%@,appid:%@, open sucess",[url absoluteString],app.appId);
    }
    }];
    } else {
    [[UIApplication sharedApplication] openURL:url];
    }
    return YES;
    } else {
    NSLog(@"webViewCustomUrlLoading:%@,appid:%@,cann't open!!!",[url absoluteString],app.appId);
    }
    return NO;
    }
    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