XCode: Exception. How to detect the cause?

前端 未结 2 1351
北海茫月
北海茫月 2021-01-14 04:10

Xcode 4.6.1 with iOS 6.1. I\'m using remote database with StackMob. Application first gives an error and after I click Play a few times, it runs fine and communicates with

相关标签:
2条回答
  • 2021-01-14 04:26

    You already had this code:

    NSError *error = nil;
    NSArray *fetchedObjects = 
        [[self managedObjectContext] executeFetchRequest:fetchRequest error:&error];
    

    So all you need is to keep going (without the breakpoint) and allow the error to log itself:

    if (!fetchedObjects)
        NSLog(@"%@", error.localizedDescription);
    
    0 讨论(0)
  • 2021-01-14 04:34

    You can check what the exception is with a simple lldb command, once the debugger stops on the exception. Select the exception like in your thread 6 here:

    enter image description here

    And then if you are running on the simulator type:

    po $eax
    

    If you are running on the device:

    po $r0  (for 32-bit)
    po $x0  (for 64-bit)
    

    You should get a description of the exception.

    0 讨论(0)
提交回复
热议问题