Files
keyboard/Shared/KBHostAppLauncher.m

41 lines
977 B
Mathematica
Raw Normal View History

//
// KBHostAppLauncher.m
// keyBoard
//
// Created by Mac on 2025/11/24.
//
// KBHostAppLauncher.m
#import "KBHostAppLauncher.h"
#import <TargetConditionals.h>
#if !TARGET_OS_EXTENSION
#import <UIKit/UIKit.h>
#endif
@implementation KBHostAppLauncher
+ (BOOL)openHostAppURL:(NSURL *)url fromResponder:(UIResponder *)startResponder {
if (!url || !startResponder) return NO;
#if TARGET_OS_EXTENSION
// App Extension 使 UIApplication
return NO;
#else
// App UIApplication responder
UIApplication *app = UIApplication.sharedApplication;
if (!app) { return NO; }
if (@available(iOS 10.0, *)) {
[app openURL:url options:@{} completionHandler:nil];
return YES;
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
return [app openURL:url];
#pragma clang diagnostic pop
}
#endif
}
@end