XCode:异常。如何检测原因? [英] XCode: Exception. How to detect the cause?

查看:136
本文介绍了XCode:异常。如何检测原因?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用iOS 6.1的Xcode 4.6.1。我正在使用与StackMob的远程数据库。应用程序首先发出错误,并且在单击播放几次后,它运行正常,并与服务器进行通信。不知道如何检测问题,应该怎么关心?



我有以下异常断点设置:





应用程序运行,然后停止在以下行:
< img src =https://i.stack.imgur.com/j5ZLH.pngalt =enter image description here>

  NSFetchRequest * fetchRequest = [[NSFetchRequest alloc] init]; 
NSEntityDescription * entity = [NSEntityDescription entityForName:@UserinManagedObjectContext: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:@UserinManagedObjectContext:self.managedObjectContext];
[fetchRequest setEntity:entity];

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

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

现在,当我运行程序,我得到以下错误:









所以我点击播放按钮



我收到以下错误:





之后,再次单击播放一次,应用程序继续运行,好像没有发生任何事情?我应该担心吗

解决方案

一旦调试器停止异常,您可以使用简单的lldb命令检查异常。在这里选择你的线程6中的异常:





然后,如果您正在运行模拟器类型:

 code> po $ eax 

如果您正在设备上运行:

  po $ r0(32位)
po $ x0(64位)

您应该了解该例外情况。


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 the server just fine. Not sure how to detect the problem and should it a concern?

I have the following exception Break Point setup:

The application runs and then stops at the following line:

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

so I changed the line above to:

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)
            {

Now when I run the program, I get the following error:

with

so I click the play button

and I get the following error:

and after I click play one more time, the Application continues to run as if nothing happened? Should I be concerned?

解决方案

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:

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.

这篇关于XCode:异常。如何检测原因?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆