HTML5   发布时间:2022-04-27  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了iOS 9上的自动布局崩溃,禁用了自动布局大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道这是一个通用的问题,但我希望有类似经历的人可能知道可能发生的事情.

我在仅限iPad的应用程序中仅在iOS 9上发生崩溃.它说NSInternalInconsistencyException.

它出现在纵向和横向模式以及许多iPad代(iPad 2,iPad Pro,iPad 4,……)上.

我没有在项目中的任何位置启用自动布局,但它看起来像是自动布局问题.

它很难复制,所以我无法在Xcode上调试它,但我看到有关崩溃分析服务“Crashlytics”的报告.这是来自Crashlytics的堆栈跟踪:

Auto layout internal error. CAnnot find an outgoing row 
head for incoming head <unkNown var (bug!) with ENGIne as delegate[...]

Thread : Fatal Exception: NSInternalInconsistencyException
0  CoreFoundation                 0x23d4568b __exceptionPreprocess
1  libobjc.A.dylib                0x356c2e17 objc_exception_throw
2  CoreFoundation                 0x23d455d1 -[NSException initWithCoder:]
3  Foundation                     0x24a873b3 -[NSISENGIne minimizeConstanTinObjectiveRowWithHead:]
4  Foundation                     0x24a86e4d -[NSISENGIne optimize]
5  Foundation                     0x24a82a53 -[NSISENGIne withBehaviors:performModifications:]
6  UIKit                          0x27e040bb -[UIView(Hierarchy) _postMovedFromSuperview:]
7  UIKit                          0x280fb227 __UIViewWasRemovedFromSuperview
8  UIKit                          0x27e02ddb -[UIView(Hierarchy) removeFromSuperview]
9  UIKit                          0x282e5fa9 -[UIKeyboardPreDictionView setPreDictionViewState:animate:notify:]
10 UIKit                          0x281e3787 -[UIKeyboardImpl updatePreDictionView]
11 UIKit                          0x27f155e3 -[UIKeyboardImpl finishLayoutChangeWithArguments:]
12 UIKit                          0x27e31437 -[UIKeyboardImpl updateLayout]
13 UIKit                          0x27e36077 -[UIKeyboardImpl setDelegate:force:]
14 UIKit                          0x27e2f6e1 -[UIPeripheralHost(UIKiTinternal) _reloadInputViewsForResponder:]
15 UIKit                          0x27e2f20d -[UIResponder(UIResponderInputViewAdditions) reloadInputViews]
16 UIKit                          0x27e8d853 -[UIResponder becomeFirstResponder]
17 UIKit                          0x27e8db6d -[UIView(Hierarchy) becomeFirstResponder]
18 UIKit                          0x27f12289 -[UITextField becomeFirstResponder]
19 UIKit                          0x27fbe69f -[UITexTinteractionAssistant(UITexTinteractionAssistant_Internal) setFirstResponderIfNecessary]
20 UIKit                          0x27fbdc75 -[UITexTinteractionAssistant(UITexTinteractionAssistant_Internal) oneFingerTap:]
21 UIKit                          0x28334e27 _UIGestureRecognizerSendTargetActions
22 UIKit                          0x27fa2303 _UIGestureRecognizerSendActions
23 UIKit                          0x27e3a7af -[UIGestureRecognizer _updateGestureWithEvent:buttonEvent:]
24 UIKit                          0x28335f2f ___UIGestureRecognizerupdate_block_invoke809
25 UIKit                          0x27dfc287 _UIGestureRecognizerRemoveObjectsFromArrayAndApplyBlocks
26 UIKit                          0x27df9e77 _UIGestureRecognizerupdate
27 UIKit                          0x27e386f9 -[UIWindow _sendGesturesForEvent:]
28 UIKit                          0x27e37e43 -[UIWindow sendEvent:]
29 UIKit                          0x27e097e5 -[UIApplication sendEvent:]
30 UIKit                          0x27e07fdf _UIApplicationHandleEventQueue
31 CoreFoundation                 0x23d08c3f __CFRUNLOOP_IS_CALLING_OUT_TO_A_sourcE0_PERFORM_FUNCTION__
32 CoreFoundation                 0x23d0882d __CFRunLoopDosources0
33 CoreFoundation                 0x23d06b9b __CFRunLoopRun
34 CoreFoundation                 0x23c5a249 CFRunLoopRunSpecific
35 CoreFoundation                 0x23c5a035 CFRunLoopRunInMode
36 Graphicsservices               0x2cd24ad1 GSEventRunModal
37 UIKit                          0x27e6f899 UIApplicationMain
38 Mr Appliance                   0xcda7b main (main.m:16)
39 libdyld.dylib                  0x35e0e873 start

问题是我不知道代码在哪里发生了.堆栈跟踪不会显示代码中发生崩溃的位置.它只说main.m第16行返回UIApplicationMain(argc,argv,nil,NSStringFromClass([AppDelegate class]));.

解决方法

main.m中的那一行是程序开始运行的地方,而不是错误发生的地方.在所有其他项目发生后,在列表顶部的#1处抛出异常.问题在于介于两者之间.

在从超级视图中删除一些视图之后会出现异常,并且它确实显示NSISENGIne错误,表明可能已为某些XIB或Storyboard打开了AutoLayout – 否则iOS会在内部使用AutoLayout来处理新布局的排列.

This answer具有几乎相同的堆栈跟踪&指出使用不正确的手势方法处理firstResponder更改和解除键盘的问题.如果你正在做类似的事情(忽略一些视图,编辑UITableView?),可能是错误方法指向一个不存在的委托?

https://stackoverflow.com/questions/33800918/uitextfield-becomefirstresponder-crashes-the-ios-app-randomly

大佬总结

以上是大佬教程为你收集整理的iOS 9上的自动布局崩溃,禁用了自动布局全部内容,希望文章能够帮你解决iOS 9上的自动布局崩溃,禁用了自动布局所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。