tencent cloud

Feedback

Last updated: 2024-11-27 18:01:51

    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 Returns 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 information 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 Obtains 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 Obtains current language set by the host app.
    * @return format: "zh-Hans"
    */
    - (NSString *)getCurrentLocalLanguage;
    
    
    /**
    * @brief If the current theme set by the host is not implemented, the theme returned in getAppBaseInfo will be the system theme.
    */
    - (NSString *)getAppTheme;
    
    /**
    * @brief Clipboard frequency control.
    */
    - (NSNumber *)getClipboardInterval
    
    // The maximum number of active mini programs. Default value: 3.
    
    - (NSInteger)maxMiniAppKeepAliveCount;
    
    // Sets the URL Scheme to open the host app of the mini program.
    
    - (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;

    Processing 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 about the mini program where the web-view component is located.
    // @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;
    }

    Compatibility for HTTP resources on iOS 18 and above

    Due to system security restrictions on iOS 18 and above, if you use HTTP resources in a mini program, you need to enable "App Transport Security Settings - Allow Arbitrary Loads" in your project. Implement the TMFMiniAppSDKDelegate protocol and use the stringWithConfigKey method to return the appropriate value for TMA_SK_MINIAPP_ATS_Allow_Arbitrary_Loads to enable this setting.
    
    //TMFMiniAppSDKDelegate protocol
    - (NSString *)stringWithConfigKey:(NSString *)key {
    if([key isEqualToString:TMA_SK_MINIAPP_ATS_Allow_Arbitrary_Loads]) {
    return @"1";
    }
    return nil;
    }
    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