gpt4 book ai didi

ios - -[UIThreadSafeNode canPerformAction :withSender:]: unrecognized selector sent to instance

转载 作者:行者123 更新时间:2023-12-02 01:55:08 25 4
gpt4 key购买 nike

我的 iOS 应用程序遇到了此崩溃。

Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x1b9079c30 __exceptionPreprocess
1 libobjc.A.dylib 0x1b8d940c8 objc_exception_throw
2 CoreFoundation 0x1b8f77fc0 -[NSOrderedSet initWithSet:copyItems:]
3 CoreFoundation 0x1b907e3d4 ___forwarding___
4 CoreFoundation 0x1b9080570 _CF_forwarding_prep_0
5 UIKitCore 0x1bcf33444 -[UIKeyboardImpl deleteForwardAndNotify:]
6 UIKitCore 0x1bcf39154 __57-[UIKeyboardImpl acceptPredictiveInput:executionContext:]_block_invoke
7 UIKitCore 0x1bcf5b0c8 -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:]
8 UIKitCore 0x1bcf366ec __100-[UIKeyboardImpl addWordTerminator:afterSpace:afterAcceptingCandidate:elapsedTime:executionContext:]_block_invoke
9 UIKitCore 0x1bcf5b0c8 -[UIKeyboardTaskExecutionContext returnExecutionToParentWithInfo:]
10 UIKitCore 0x1bcf2bdc0 __55-[UIKeyboardImpl handleKeyboardInput:executionContext:]_block_invoke_2
11 UIKitCore 0x1bcf5cd70 -[UIKeyboardTaskEntry execute:]
12 UIKitCore 0x1bcf5b6d4 -[UIKeyboardTaskQueue continueExecutionOnMainThread]
13 libobjc.A.dylib 0x1b8d8faf0 -[NSObject performSelector:withObject:]
14 Foundation 0x1b946ec10 __NSThreadPerformPerform
15 CoreFoundation 0x1b8ff5260 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
16 CoreFoundation 0x1b8ff51b4 __CFRunLoopDoSource0
17 CoreFoundation 0x1b8ff4920 __CFRunLoopDoSources0
18 CoreFoundation 0x1b8fef7ec __CFRunLoopRun
19 CoreFoundation 0x1b8fef098 CFRunLoopRunSpecific
20 GraphicsServices 0x1c3159534 GSEventRunModal
21 UIKitCore 0x1bd10f7ac UIApplicationMain
22 Haraj 0x102fc6058 main + 15 (main.m:15)
23 libdyld.dylib 0x1b8e6ef30 <redacted>

到目前为止,已报告超过 100 起崩溃事件。这种情况仅发生在 iOS 12 和 iOS 13 中。

我无法找到这是如何发生的以及如何重现它。

堆栈跟踪不显示我的应用程序的任何代码。

我已经上传了完整的崩溃报告 here .

任何帮助将不胜感激。

最佳答案

这似乎是与 iOS 文本输入中的“前向删除”相关的古老错误的回归:http://www.openradar.me/15114422

我相信由于新的“滑动打字”键盘,它已经退化了。

您有 2 个选项可以修复:

  1. 将已弃用的 UIWebView 升级为 WKWebView
  2. 黑客解决方案:在运行时在 UIThreadSafeNode 上插入缺少的选择器。

以下是如何插入缺少的选择器的代码示例:

BOOL canPerformAction(id withSender) {
return false;
}

- (void)viewDidLoad {
[super viewDidLoad];

Class class = NSClassFromString(@"UIThreadSafeNode");
class_addMethod(class, @selector(canPerformAction:withSender:), (IMP)canPerformAction, "@@:");
}

您可能应该将方法插入放置在仅加载一次的位置,例如 AppDelegate 中。

如果您需要的话,这是完整的示例项目: https://github.com/elliotfiske/UIWebView-TextEntry-CrashFix/tree/master

如何重现:

在 UIWebView 中创建一个文本输入表单,输入一些单词,然后将光标移动到句子中间单词的确切末尾。

然后,选择任意预测文本建议。请在此处查看正在运行的错误:Screen recording of the crash reproduction

关于ios - -[UIThreadSafeNode canPerformAction :withSender:]: unrecognized selector sent to instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58285055/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com