初始项目2

This commit is contained in:
2025-10-27 22:02:46 +08:00
parent a6c077a42d
commit efb04d134e

View File

@@ -11,28 +11,11 @@
#import <AFNetworking/AFNetworking.h> #import <AFNetworking/AFNetworking.h>
#import <Bugly/Bugly.h> #import <Bugly/Bugly.h>
static NSString * const kKBKeyboardExtensionBundleId = @"com.keyBoard.CustomKeyboard"; 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 @implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
self.window.backgroundColor = [UIColor whiteColor]; self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible]; [self.window makeKeyAndVisible];
@@ -40,7 +23,11 @@ static BOOL KBIsKeyboardEnabled(void) {
self.window.rootViewController = vc; self.window.rootViewController = vc;
/// ///
[self getNetJudge]; [self getNetJudge];
[Bugly startWithAppId:BuglyId]; /// Bugly
BuglyConfig *buglyConfig = [BuglyConfig new];
/// GroupID
// buglyConfig.applicationGroupIdentifier = @"";
[Bugly startWithAppId:BuglyId config:buglyConfig];
/// ///
dispatch_async(dispatch_get_main_queue(), ^{ dispatch_async(dispatch_get_main_queue(), ^{
[self kb_presentPermissionIfNeeded]; [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 @end