/*** @brief Superapp应用名称 - Superapp name* 此 API 提供用于文本显示的superapp名称 - Mainly used for copywriting prompts*/- (NSString *)appName;/**@brief Superapp版本号 - Superapp version* @return 返回的是版本字符串,例如1.0.0 - returns a version string, such as 1.0.0*/- (NSString *)getAppVersion;/*** @brief 网络状态 - The network status*/- (TMANetWorkStatus)getAppNetworkStatus;/*** @brief 机型信息 - The Model information*/- (NSString *)getAppIPhoneModel;/*** @brief 设备信息 - The device information* @return 格式 - format : {@"brand":@"iPhone",@"model":@"iPhone 11<iPhone12,1>",@"system":@"ios",@"platform":@"iOS 16.4.1"}*/- (NSDictionary *)getAppDeviceInfo;/*** @brief Superapp基础信息 - Get basic information of the superapp* @return 格式 - format : {@"SDKVersion":@"2.32.2",@"model":@"iPhone 11<iPhone12,1>",@"system":@"ios",@"platform":@"iOS 16.4.1"}*/- (NSDictionary *)getAppBaseInfo;/*** @brief Superapp设置的当前语言 - Get current language set by the Superapp* @return 格式 - format : "zh-Hans"*/- (NSString *)getCurrentLocalLanguage;/*** @brief Superapp设置的当前主题 如果不实现此方法 那么getAppBaseInfo中返回的theme为系统主题 - The current theme set by the superapp. If this method is not implemented, the theme returned in getAppBaseInfo will be the system theme.*/- (NSString *)getAppTheme;/*** @brief 可设置剪贴板频控时间,单位是秒 - Configurable clipboard rate-limit interval, in seconds.*/- (NSNumber *)getClipboardInterval;/*** @brief 小程序最多保活的个数,默认是3 - The maximum number of mini programs that can be kept alive, the default is 3*/- (NSInteger)maxMiniAppKeepAliveCount;/*** @brief Superr配置的Scheme - Superapp URL Scheme*/- (NSString *)getAppScheme;
/*** @brief 小程序录屏/屏幕录制状态发生变化时回调 - Callback when the mini program's screen recording status changes** @param appletInfo 当前小程序信息 - The current mini program information* @param isCapture 是否正在录屏,YES 表示开始录屏,NO 表示结束录屏 - Whether screen recording is in progress; YES means recording started, NO means recording ended* @param pagePath 状态变化时所在的页面路径 - The page path where the status change occurs*/- (void)applet:(TMFMiniAppInfo *)appletInfo screenCaptureStatusChanged:(BOOL)isCapture atPagePath:(NSString *)pagePath;/*** @brief 用户在小程序内进行截屏操作时回调 - Callback when the user takes a screenshot within the mini program** @param appletInfo 当前小程序信息 - The current mini program information* @param pagePath 截屏时所在的页面路径 - The page path where the screenshot is taken*/- (void)appletDidTakeScreenshot:(TMFMiniAppInfo *)appletInfo atPagePath:(NSString *)pagePath;/*** @brief 返回自定义的水印视图,用于叠加在小程序页面上 - Return a custom watermark view to overlay on the mini program page** @param appletInfo 当前小程序信息 - The current mini program information* @return 自定义水印视图,返回 nil 则不展示水印 - The custom watermark view; return nil to show no watermark*/- (nullable UIView *)appletCustomizeWatermarkView:(TMFMiniAppInfo *)appletInfo;
// 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 success",[url absoluteString],app.appId);}}];} else {[[UIApplication sharedApplication] openURL:url];}return YES;} else {NSLog(@"webViewCustomUrlLoading:%@,appid:%@,can't open!!!",[url absoluteString],app.appId);}return NO;}
//TMFMiniAppSDKDelegate protocol- (NSString *)stringWithConfigKey:(NSString *)key {if([key isEqualToString:TMA_SK_MINIAPP_ATS_Allow_Arbitrary_Loads]) {return @"1";}return nil;}
//TMFMiniAppSDKDelegate protocol- (NSString *)stringWithConfigKey:(NSString *)key {if([key isEqualToString:TMA_SK_MINIAPP_EnableDebug_Allow]) {return @"0";}return nil;}
//TMFMiniAppSDKDelegate protocol- (NSString *)stringWithConfigKey:(NSString *)key {if([key isEqualToString:TMA_SK_MINIAPP_NavigationItem_HidesSharedBackground]) {return @"1";}return nil;}
- (NSString *)stringWithConfigKey:(NSString *)key {if ([key isEqualToString:TMA_SK_MINIAPP_WebView_DomainError_PagePath]) {return [[NSBundle mainBundle] pathForResource:@"my_error_page"ofType:@"html"inDirectory:@"Resource/jssdk"];}return nil;}
<script>var msg = decodeURIComponent(new URLSearchParams(location.search).get('msg') || '');document.getElementById('tip').innerText = msg;</script>
- (nullable NSString *)miniGameJSPreludeForAppInfo:(TMFMiniAppInfo *)appInfo {// 可按 appInfo.appId 区分不同小游戏return @"(function(){ globalThis.__HOST_ENV__ = { channel: 'demo' }; })();";}
//TMFMiniAppSDKDelegate protocol- (NSString *)stringWithConfigKey:(NSString *)key {if([key isEqualToString:TMA_SK_MINIAPP_KongServer_RequestTimeout]) {return @"60";}return nil;}
//TMFMiniAppSDKDelegate protocol- (NSString *)stringWithConfigKey:(NSString *)key {if([key isEqualToString:TMA_SK_MINIAPP_InnerAudio_UnmuteOnVolumeChanged]) {return @"1";}return nil;}
文档反馈