Forum Archive

TableView crash in Xcode

dvader9

I've tried to run an Xcode project with the simple tableview example provided in the ui-tutorial post (ShowTableView.py and ShowTableView.pyui from https://omz-forums.appspot.com/pythonista/post/5588266841538560). This crashes every time for me at startup, even before I start interact with the table. So I'm wondering about the following:

  • for those who are also using Xcode with Pythonista, do you mind giving it a shot, and let me know if this also crashes for you?

  • @omz, if it's not too much to ask, can you try to run in on your machine, and see if this is a fixable (or already fixed in 1.6) bug?

  • the only thing that you'll need to change in the .py script, is ensure that your project knows where to find the .pyui file. There have been previous discussions on this.

For those interested, the output of the crash, as displayed in Xcode, is the following:

2015-01-17 13:56:40.494 PythonistaProject[4675:194482] +[UIResponder om_firstResponder]: unrecognized selector sent to class 0x2c81314

2015-01-17 13:56:40.942 PythonistaProject[4675:194482] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIResponder om_firstResponder]: unrecognized selector sent to class 0x2c81314'

*** First throw call stack:

(

0   CoreFoundation                      0x044a9946 __exceptionPreprocess + 182

1   libobjc.A.dylib                     0x0412ea97 objc_exception_throw + 44

2   CoreFoundation                      0x044b1465 +[NSObject(NSObject) doesNotRecognizeSelector:] + 277

3   CoreFoundation                      0x043fa3e7 ___forwarding___ + 1047

4   CoreFoundation                      0x043f9fae _CF_forwarding_prep_0 + 14

5   PythonistaProject                   0x00433273 -[SUITableView tableView:didEndDisplayingCell:forRowAtIndexPath:] + 39

6   UIKit                               0x02031c09 -[UITableView _reuseTableViewCell:withIndexPath:didEndDisplaying:] + 169

7   UIKit                               0x0203f3d5 __25-[UITableView reloadData]_block_invoke1575 + 148

8   CoreFoundation                      0x043cfe33 __53-[__NSArrayM enumerateObjectsWithOptions:usingBlock:]_block_invoke + 99

9   CoreFoundation                      0x043cf4cf -[__NSArrayM enumerateObjectsWithOptions:usingBlock:] + 239

10  UIKit                               0x0203ea52 -[UITableView reloadData] + 1487

11  PythonistaProject                   0x0044f21b __TableView_reload_block_invoke + 39

12  PythonistaProject                   0x0041fdd4 __sui_dispatch_main_sync_block_invoke + 51

13  libdispatch.dylib                   0x04aa4e2f _dispatch_client_callout + 14

14  libdispatch.dylib                   0x04a8e0aa _dispatch_barrier_sync_f_slow_invoke + 115

15  libdispatch.dylib                   0x04aa4e2f _dispatch_client_callout + 14

16  libdispatch.dylib                   0x04a8b90e _dispatch_main_queue_callback_4CF + 606

17  CoreFoundation                      0x0440395e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14

18  CoreFoundation                      0x043c2760 __CFRunLoopRun + 2256

19  CoreFoundation                      0x043c1bcb CFRunLoopRunSpecific + 443

20  CoreFoundation                      0x043c19fb CFRunLoopRunInMode + 123

21  GraphicsServices                    0x067c924f GSEventRunModal + 192

22  GraphicsServices                    0x067c908c GSEventRun + 104

23  UIKit                               0x01f338b6 UIApplicationMain + 1526

24  PythonistaProject                   0x0001c756 main + 134

25  libdyld.dylib                       0x04ad0ac9 start + 1

)

libc++abi.dylib: terminating with uncaught exception of type NSException

(lldb)

I started looking specifically into this example, because I had another project I was trying to build, which also had a TableView in it, and crashed every time a TableView Cell move in/out of the field of view when scrolling, with this same message: 'unrecognized selector sent to class'.

While I know this (Pythonista in Xcode) isn't the main focus of this forum, I'm not sure where else to look for a solution on this. Thanks all for your help.

dvader9

Note that this DOES NOT crash when run in the Pythonista App on the iPad (iOS7 with Pythonista 1.5, or iOS8 with Pythonista 1.6). But it DOES crash when run in the iOS Simulator (iOS8) or on the iPad (iOS8) as a compiled Xcode project.