iOS中的UITextField或UITextView的NSInternalInconsistencyException Shouldn't have translate session崩溃

本文首发地址:开源实践网:iOS中的UITextField或UITextView的NSInternalInconsistencyException Shouldn't have translate session崩溃

最近在buggly上查看崩溃的时候,发现NSInternalInconsistencyException Shouldn't have translate session这样的崩溃,不出意料,当我点击进去查看详情的时候,也是崩溃到了系统堆栈,然后尝试百度和谷歌大法,发现属于iOS15系统上的崩溃,暂时还没有大佬给出修复方案,没办法只好自己分析和解决了。

一、崩溃堆栈

0   CoreFoundation ___exceptionPreprocess + 216
1   libobjc.A.dylib _objc_exception_throw + 56
2  Foundation__userInfoForFileAndLine
3  UIKitCore -[UITextInputController _translate:] + 404
4  UIKitCore -[UITextField _translate:] + 80
5  UIKitCore +[UIPasteboard _performAsDataOwnerForAction:responder:block:] + 204
6  UIKitCore -[UICalloutBar buttonPressed:] + 508
7  UIKit -[UICalloutBarAccessibility buttonPressed:] + 40
8  UIKitCore -[UICalloutBarButton fadeAndSendActionWithAuthenticationMessage:] + 304
9  Foundation ___NSFireDelayedPerform + 420
10  CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 28
11  CoreFoundation ___CFRunLoopDoTimer + 1008
12  CoreFoundation___CFRunLoopDoTimers + 316
13  CoreFoundation___CFRunLoopRun + 1964
14  CoreFoundation_CFRunLoopRunSpecific + 572
15  GraphicsServices_GSEventRunModal + 160
16  UIKitCore-[UIApplication _run] + 1080
17  UIKitCore_UIApplicationMain + 336
18  homework main (main.m:39)
19  ???  0x00000001040b0000 + 0

二、问题分析

1、翻译Shouldn't have translate session这个提示可以得出,当前不支持翻译功能

2、然后继续查看堆栈有UITextField的关键字,说明是UITextField不支持。

3、查阅相关功能代码,然后找到buggly崩溃最多的系统版本尝试复现,我的运气好,复现了,可以确认是UITextField中的长按翻译导致的崩溃。

4、我在使用的时候,其实在iOS15.0的系统上是不会崩溃的,不知道为什么在15.4.1上为什么会崩溃

三、问题解决

参考:iOS中的UITextField或UITextView的NSInternalInconsistencyException Shouldn't have translate session崩溃
个人独立开发的完全开源的编程学习网站,跪求“注册、点赞、评论 ”三连

你可能感兴趣的:(iOS中的UITextField或UITextView的NSInternalInconsistencyException Shouldn't have translate session崩溃)