程序收到信号SIGABRT [英] Program received signal SIGABRT

查看:173
本文介绍了程序收到信号SIGABRT的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone应用程序中工作,我使用UIImage选择器控件从照片库中选择一个图像,然后处理它并分别使用UIImageview和UITextview显示图像和相应的输出。对于一些图像,它工作正常,并为一些图像程序崩溃,并在检查这个断点时,我收到消息,如PROGRAM RECEIVED SIGNAL SIGABRT。任何人都可以建议我如何处理这个错误。
注意:对于我得到输出的每个图像,我用断点检查它。
我的示例代码在这里,

I working in iPhone application, i am picking an image from photo library using UIImage picker control, then processing it and displays the image and the corresponding output using UIImageview and UITextview respectively. For some images it working fine and for some of images program crashed and while checking this with break point i am getting message like PROGRAM RECEIVED SIGNAL SIGABRT. can any one suggest me how to handle this error. Note: For every image i am getting output, i checked it with breakpoint. my sample code is here,

要显示图像:

 CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 240.0f);
 UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
 [myImage setImage:img];
 myImage.opaque = YES; // explicitly opaque for performance
 [self.view addSubview:myImage];
 [myImage release];

显示文字:

 CGRect frame = CGRectMake(0.0f, 250.0f, 320.0f,25.0f);
 UITextView * tmpTextView = [[UITextView alloc]initWithFrame:frame];
 tmpTextView.text = [NSString stringWithFormat:@"%@%@",@"value: ", somevalue];
 [self.view addSubview:tmpTextView];
 [tmpTextView release];


推荐答案

SIGABRT abort(3) c> 功能。在没有更多信息的情况下,无法准确判断程序中发生了什么,但是调用 abort()的最常见原因是:

SIGABRT is raised by the abort(3) function. It's impossible to tell exactly what's going on in your program without more information, but the most common reasons that abort() gets called are:


  • 您正在向不支持/实现该消息的Objective-C对象发送消息。这会导致可怕的无法识别的选择器发送到实例错误。

  • 某个地方断言失败。在定义宏 NDEBUG 的非调试版本中,标准库宏 断言(3) 在断言失败时调用 abort()

  • 你有一些内存踩踏/分配错误。当 malloc / free 检测到损坏的堆时,可以调用 abort()(请参阅此问题

  • 您正在抛出未捕获的异常(C ++异常或Objective-C异常)

  • You're sending a message to an Objective-C object that doesn't support/implement that message. This results in the dreaded "unrecognized selector sent to instance" error.
  • You have a failed assertion somewhere. In non-debug builds that define the macro NDEBUG, the standard library macro assert(3) calls abort() when the assertion fails
  • You have some memory stomping/allocation error. When malloc/free detect a corrupted heap, the may call abort() (see, e.g. this question)
  • You're throwing an uncaught exception (either a C++ exception or an Objective-C exception)

在几乎所有情况下,调试控制台都会为您提供有关导致 abort()调用的更多信息,因此请务必查看。

In almost all cases, the debug console will give you a little more information about what's causing abort() to be called, so always take a look there.

这篇关于程序收到信号SIGABRT的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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