处理ios18从其他app用自己键盘 拉起主app的bug

其他问题
This commit is contained in:
2025-11-24 19:58:19 +08:00
parent 8e93f8f86f
commit 15e37841bb
20 changed files with 264 additions and 88 deletions

View File

@@ -7,7 +7,7 @@
#import "Masonry.h"
#import "KBResponderUtils.h" // UIInputViewController
#import "KBHUD.h"
#import "KBExtensionAppLauncher.h"
#import "KBHostAppLauncher.h"
@interface KBFullAccessGuideView ()
@property (nonatomic, strong) UIControl *backdrop;
@@ -157,31 +157,20 @@
#pragma mark - Actions
// KBResponderUtils.h
// App访 Scheme UL
// App访宿 UIApplication + Scheme
- (void)onTapGoEnable {
UIInputViewController *ivc = KBFindInputViewController(self);
if (!ivc) { [self dismiss]; return; }
// responder
UIResponder *start = ivc.view ?: (UIResponder *)self;
// SchemeApp openURL
// 使 App Scheme
// SchemeAppDelegate kbkeyboardAppExtension://settings
NSURL *scheme = [NSURL URLWithString:[NSString stringWithFormat:@"%@@//settings?src=kb_extension", KB_APP_SCHEME]];
// Universal Link AASA/Associated Domains KB_UL_BASE
NSURL *ul = [NSURL URLWithString:[NSString stringWithFormat:@"%@?src=kb_extension", KB_UL_SETTINGS]];
__weak typeof(self) weakSelf = self;
[KBExtensionAppLauncher openPrimaryURL:scheme
fallbackURL:ul
usingInputController:ivc
source:self
completion:^(BOOL ok) {
__strong typeof(weakSelf) strongSelf = weakSelf;
if (!strongSelf) return;
if (ok) {
[strongSelf dismiss];
} else {
NSString *showInfo = [NSString stringWithFormat:KBLocalized(@"Follow: Settings → General → Keyboard → Keyboards → %@ → Allow Full Access"),AppName];
[KBHUD showInfo:showInfo];
}
}];
BOOL ok = [KBHostAppLauncher openHostAppURL:scheme fromResponder:start];
if (ok) {
[self dismiss];
} else {
NSString *showInfo = [NSString stringWithFormat:KBLocalized(@"Follow: Settings → General → Keyboard → Keyboards → %@ → Allow Full Access"),AppName];
[KBHUD showInfo:showInfo];
}
}
@end