13

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];

and this is the error

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!'

Ronak Chaniyara
  • 5,335
  • 3
  • 24
  • 51
Nabeel Thobani
  • 939
  • 10
  • 23
  • +1 Interestingly I'm also using Box SDK v2, and having a similar problem when pushing a view controller. I think it's something to do with the way Box is wrapping stuff in an auto release pool? because that's where it breaks for me (in BoxAPIOperation). I "fixed" the problem by wrapping the VC push in performSelector:withObject:delay: with 0 delay (basically postponing till end of run loop). :/ – David James Aug 04 '14 at 18:08
  • Thanks for posting this question, because people like we are sometimes scared that How to a sk question, or lack of time (excuses), we are not asking the question.. thanks for asking question, mine has solved . – Arpit B Parekh Jul 23 '15 at 14:12

1 Answers1

36

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().

Léo Natan
  • 56,823
  • 9
  • 150
  • 195