tencent cloud

文档反馈

最后更新时间:2024-10-29 18:16:13

    宿主 App 相关接口

    /**
    * @brief SDK宿主应用名称 - Host app name
    * 主要用于文案提示使用 - Mainly used for copywriting prompts
    */
    - (NSString *)appName;
    
    /**
    * @brief SDK宿主平台版本 - Host app version
    * @return 返回的是小写字符串,例如1.0.0 - returns a lowercase string, such as 1.0.0
    */
    - (NSString *)getAppVersion;
    
    /**
    * @brief SDK宿主平台的网络状态 - The network status of the host platform
    */
    
    - (TMANetWorkStatus)getAppNetworkStatus;
    
    /**
    * @brief SDK宿主平台的机型信息 - SDK host platform model information
    */
    - (NSString *)getAppIPhoneModel;
    
    /**
    * @brief SDK宿主平台设备信息 - SDK host platform device information
    * @return 格式 - format : {@"brand":@"iPhone",@"model":@"iPhone 11<iPhone12,1>",@"system":@"ios",@"platform":@"iOS 16.4.1"}
    */
    - (NSDictionary *)getAppDeviceInfo;
    /**
    * @brief 获取宿主APP基础信息 - Get 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 宿主设置的当前语言 - Get current language set by the app
    * @return 格式 - format : "zh-Hans"
    */
    - (NSString *)getCurrentLocalLanguage;
    
    
    /**
    * @brief 宿主设置的当前主题 如果不实现此方法 那么getAppBaseInfo中返回的theme为系统主题 - The current theme set by the app. If this method is not implemented, the theme returned in getAppBaseInfo will be the system theme.
    */
    - (NSString *)getAppTheme;
    
    /**
    * @brief 剪贴板频控 - Clipboard frequency control
    */
    - (NSNumber *)getClipboardInterval
    
    // 小程序最多保活的个数,默认是3
    // The maximum number of mini programs that can be kept alive, the default is 3
    - (NSInteger)maxMiniAppKeepAliveCount;
    
    // 设置打开小程序宿主URL Scheme
    // Set the host to open the applet URL Scheme
    - (NSString *)getAppScheme;

    截屏、录屏事件和添加水印

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

    web-view组件中特殊链接处理

    对于 web-view 组件页面中要处理的特殊链接透传至宿主 app,由宿主 app 进行处理。
    // web-view组件中跳转非http/https时触发,用于处理web-view组件中特殊url的情况,比如打开其它App - Triggered when redirecting to non-http/https in the web-view component. Used to handle special URLs in the web-view component, such as opening other apps.
    // @param app {TMFMiniAppInfo} web-view组件所在的小程序信息 - Mini-program information where the web-view component is located
    // @param url {NSURL} 要打开的url - The url to open
    // @return 是否拦截处理 - Whether to intercept processing
    - (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;
    }
    
    联系我们

    联系我们,为您的业务提供专属服务。

    技术支持

    如果你想寻求进一步的帮助,通过工单与我们进行联络。我们提供7x24的工单服务。

    7x24 电话支持