Search code examples
iosxcodeswiftcrash-reports

how to even start reading this iphone crash log to debug?


I have this crash happening in my app. iOS noob here, don't even know where to start debugging this. How to read this crash log? Where/which file/function is the problem starting?

2015-04-26 16:55:53.743 MyTestApp[10058:924348] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Can only call -[PFObject init] on subclasses conforming to PFSubclassing.'
*** First throw call stack:
(
0   CoreFoundation                      0x00000001032c6c65 __exceptionPreprocess + 165
1   libobjc.A.dylib                     0x0000000102f5fbb7 objc_exception_throw + 45  
2   CoreFoundation                      0x00000001032c6b9d +[NSException raise:format:] + 205
3   MyTestApp                            0x00000001014d8823 -[PFObject(Private) init] + 144
4   MyTestApp                            0x00000001014a91b0 _TTOFCSo8PFObjectcfMS_FT_S_ + 16
5   MyTestApp                            0x00000001014a7c67 _TFCSo8PFObjectCfMS_FT_S_ + 71
6   MyTestApp                            0x00000001014a1965 _TFC8MyTestApp22MessagesViewControllercfMS0_FT5coderCSo7NSCoder_S0_ + 213
7   MyTestApp                            0x00000001014a1a1d _TToFC8MyTestApp22MessagesViewControllercfMS0_FT5coderCSo7NSCoder_S0_ + 45
8   UIKit                               0x0000000103bc828b -[UIClassSwapper initWithCoder:] + 205
9   UIKit                               0x0000000103d19ab6 UINibDecoderDecodeObjectForValue + 705
10  UIKit                               0x0000000103d197ec -[UINibDecoder decodeObjectForKey:] + 276
11  UIKit                               0x0000000103bc7e84 -[UIRuntimeConnection initWithCoder:] + 153
12  UIKit                               0x0000000103d19ab6 UINibDecoderDecodeObjectForValue + 705
13  UIKit                               0x0000000103d19c85 UINibDecoderDecodeObjectForValue + 1168
14  UIKit                               0x0000000103d197ec -[UINibDecoder decodeObjectForKey:] + 276
15  UIKit                               0x0000000103bc7327 -[UINib instantiateWithOwner:options:] + 990
16  UIKit                               0x0000000103e29aba -[UIStoryboard instantiateViewControllerWithIdentifier:] + 181
17  MyTestApp                            0x000000010148b406 _TFC8MyTestApp22OverviewViewController9tableViewfS0_FTCSo11UITableView23didSelectRowAtIndexPathCSo11NSIndexPath_T_ + 246
18  MyTestApp                            0x000000010148bbff _TToFC8MyTestApp22OverviewViewController9tableViewfS0_FTCSo11UITableView23didSelectRowAtIndexPathCSo11NSIndexPath_T_ + 79
19  UIKit                               0x00000001039e0dc9 -[UITableView _selectRowAtIndexPath:animated:scrollPosition:notifyDelegate:] + 1293
20  UIKit                               0x00000001039e0f0a -[UITableView _userSelectRowAtPendingSelectionIndexPath:] + 219
21  UIKit                               0x000000010391362c _applyBlockToCFArrayCopiedToStack + 314
22  UIKit                               0x00000001039134a6 _afterCACommitHandler + 533
23  CoreFoundation                      0x00000001031f9ca7 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 23
24  CoreFoundation                      0x00000001031f9c00 __CFRunLoopDoObservers + 368
25  CoreFoundation                      0x00000001031efa33 __CFRunLoopRun + 1123
26  CoreFoundation                      0x00000001031ef366 CFRunLoopRunSpecific + 470
27  GraphicsServices                    0x0000000105032a3e GSEventRunModal + 161
28  UIKit                               0x00000001038ef900 UIApplicationMain + 1282
29  MyTestApp                            0x000000010149f137 main + 135
30  libdyld.dylib                       0x0000000108ac6145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

Solution

  • The reason for the crash is on the first line:

    reason: 'Can only call -[PFObject init] on subclasses conforming to PFSubclassing.'

    This means that your subclass is inheriting from PFObject but not conforming to the protocol PFSubclassing. Thus, init cannot be called on your subclass.

    Ex.

    @interface MyPFSubclass : PFObject
    

    Should be replaced with:

    @interface MyPFSubclass : PFObject <PFSubclassing>
    

    For more information on interpreting the stacktrace I recommend this tutorial: My App Crashed, Now What? – Part 1