void _UIPerformResizeOfTextViewForTextContainer 中的断言失败 [英] Assertion failure in void _UIPerformResizeOfTextViewForTextContainer

查看:24
本文介绍了void _UIPerformResizeOfTextViewForTextContainer 中的断言失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从 BOX 导入文件.我用过 box sdk V2.它正在成功导入,但在导入时,屏幕必须在下一个控制器上导航.我遇到了这个问题

I am importing a file from BOX. I have used box sdk V2. It's importing successfully but as it imports the screen has to navigate on a next controller. I am having crash on this

NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"CategoryOptionView"
                                                      owner:nil
                                                    options:nil];

这是错误

无效断言失败_UIPerformResizeOfTextViewForTextContainer(NSLayoutManager *, UIView *, NSTextContainer *, NSUInteger)(),/SourceCache/UIFoundation_Sim/UIFoundation-229/UIFoundation/TextSystem/NSLayoutManager_Private.m:15162013-11-22 08:04:10.083 PunchList[1019:6a2b] *** 由于未捕获的异常NSInternalInconsistencyException"而终止应用程序,原因:'仅在主线程上运行!'

Assertion failure in void _UIPerformResizeOfTextViewForTextContainer(NSLayoutManager *, UIView *, NSTextContainer *, NSUInteger)(), /SourceCache/UIFoundation_Sim/UIFoundation-229/UIFoundation/TextSystem/NSLayoutManager_Private.m:1516 2013-11-22 08:04:10.083 PunchList[1019:6a2b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Only run on the main thread!'

推荐答案

好吧,异常原因把问题抛之脑后;您应该在主线程上运行此代码.尝试使用 dispatch_syncdispatch_async 封闭视图创建和笔尖加载,并使用 dispatch_get_main_queue() 传递主队列.

Well, the exception reason gives the problem away; you should run this code on the main thread. Try enclosing the view creation and nib loading using dispatch_sync or dispatch_async and passing the main queue using dispatch_get_main_queue().

这篇关于void _UIPerformResizeOfTextViewForTextContainer 中的断言失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆