From efb04d134ea0225930cbbbd209816f7b6eba0725 Mon Sep 17 00:00:00 2001 From: CodeST <694468528@qq.com> Date: Mon, 27 Oct 2025 22:02:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E9=A1=B9=E7=9B=AE2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- keyBoard/AppDelegate.m | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/keyBoard/AppDelegate.m b/keyBoard/AppDelegate.m index 08e0a65..7bae424 100644 --- a/keyBoard/AppDelegate.m +++ b/keyBoard/AppDelegate.m @@ -11,28 +11,11 @@ #import #import static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoard.CustomKeyboard"; -static BOOL KBIsKeyboardEnabled(void) { - for (UITextInputMode *mode in [UITextInputMode activeInputModes]) { - NSString *identifier = nil; - @try { - identifier = [mode valueForKey:@"identifier"]; // not a public API - } @catch (__unused NSException *e) { - identifier = nil; - } - if ([identifier isKindOfClass:[NSString class]] && - [identifier rangeOfString:kKBKeyboardExtensionBundleId].location != NSNotFound) { - return YES; - } - } - return NO; -} - @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - // Override point for customization after application launch. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; @@ -40,7 +23,11 @@ static BOOL KBIsKeyboardEnabled(void) { self.window.rootViewController = vc; /// 获取网络权限 [self getNetJudge]; - [Bugly startWithAppId:BuglyId]; + /// Bugly + BuglyConfig *buglyConfig = [BuglyConfig new]; + /// 设置GroupID进行配置 +// buglyConfig.applicationGroupIdentifier = @""; + [Bugly startWithAppId:BuglyId config:buglyConfig]; /// 判断获取键盘权限 dispatch_async(dispatch_get_main_queue(), ^{ [self kb_presentPermissionIfNeeded]; @@ -95,4 +82,22 @@ static BOOL KBIsKeyboardEnabled(void) { }]; } + +static BOOL KBIsKeyboardEnabled(void) { + for (UITextInputMode *mode in [UITextInputMode activeInputModes]) { + NSString *identifier = nil; + @try { + identifier = [mode valueForKey:@"identifier"]; // not a public API + } @catch (__unused NSException *e) { + identifier = nil; + } + if ([identifier isKindOfClass:[NSString class]] && + [identifier rangeOfString:kKBKeyboardExtensionBundleId].location != NSNotFound) { + return YES; + } + } + return NO; +} + + @end