ios - XCode:异常。如何检测原因?

标签 ios xcode exception

Xcode 4.6.1 与 iOS 6.1。我在 StackMob 中使用远程数据库。应用程序首先给出一个错误,在我点击播放几次后,它运行良好并且与服务器通信正常。不确定如何检测问题,是否应该担心?

我有以下异常断点设置:

enter image description here

应用程序运行,然后在以下行停止: enter image description here

   NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    NSEntityDescription *entity = [NSEntityDescription entityForName:@"User" inManagedObjectContext:self.managedObjectContext];
    [fetchRequest setEntity:entity];

    NSPredicate *predicate = [NSPredicate predicateWithFormat:@"email == %@", self.emailAddressField.text];
    [fetchRequest setPredicate:predicate];

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

所以我将上面的行更改为:

NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
        NSEntityDescription *entity = [NSEntityDescription entityForName:@"User" inManagedObjectContext:self.managedObjectContext];
        [fetchRequest setEntity:entity];

        NSPredicate *predicate = [NSPredicate predicateWithFormat:@"username == %@", self.usernameField.text];
        [fetchRequest setPredicate:predicate];

        [managedObjectContext executeFetchRequest:fetchRequest onSuccess:^(NSArray *fetchedObjects)
            {

现在当我运行程序时,出现以下错误:

enter image description here

enter image description here

所以我点击播放按钮 enter image description here

我收到以下错误:

enter image description here

在我再次点击播放后,应用程序继续运行,就好像什么也没发生一样?我应该担心吗?

最佳答案

一旦调试器停止在异常上,您可以使用简单的 lldb 命令检查异常是什么。在此处选择线程 6 中的异常:

enter image description here

然后如果你在模拟器类型上运行:

po $eax

如果你在设备上运行:

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

您应该得到异常的描述。

关于ios - XCode:异常。如何检测原因?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16267930/

相关文章:

ios - Objective c SpriteKit 节点

iphone - 更改 UITabBarItem 中的字体

javascript - 是否可以通过 window.onerror 获取局部变量和参数值

ios - 通过单击按钮重置 iOS 手势

objective-c - NSFetchedResultsController 不显示来自后台线程的更改

c++ - 即使我在 C++ 中使用 delete[] 也发出 SIGABRT 信号

ios - 内部查询解析

Python异常处理: Is there a method to know what type of exceptions my code can possibly throw?

java - 如果 java 中出现未处理的异常,谁打印异常堆栈跟踪?

ios - 以编程方式检查和获取 NSLayoutConstraint 冲突的任何方法?