Host app APIs
- (NSString *)appName;
- (NSString *)getAppVersion;
- (TMANetWorkStatus)getAppNetworkStatus;
- (NSString *)getAppIPhoneModel;
- (NSDictionary *)getAppDeviceInfo;
- (NSDictionary *)getAppBaseInfo;
- (NSString *)getCurrentLocalLanguage;
- (NSString *)getAppTheme;
- (NSNumber *)getClipboardInterval
- (NSInteger)maxMiniAppKeepAliveCount;
- (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.
- (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.
- (NSString *)stringWithConfigKey:(NSString *)key {
if([key isEqualToString:TMA_SK_MINIAPP_ATS_Allow_Arbitrary_Loads]) {
return @"1";
}
return nil;
}
Was this page helpful?