void _UIPerformResizeOfTextViewForTextContainer 中的断言失败 [英] Assertion failure in 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_sync
或 dispatch_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屋!