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,
To display image:
CGRect myImageRect = CGRectMake(0.0f, 0.0f, 320.0f, 2开发者_运维问答40.0f);
UIImageView *myImage = [[UIImageView alloc] initWithFrame:myImageRect];
[myImage setImage:img];
myImage.opaque = YES; // explicitly opaque for performance
[self.view addSubview:myImage];
[myImage release];
To display text:
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
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:
- 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 macroassert(3)
callsabort()
when the assertion fails - You have some memory stomping/allocation error. When
malloc
/free
detect a corrupted heap, the may callabort()
(see, e.g. this question) - You're throwing an uncaught exception (either a C++ exception or an Objective-C exception)
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.
精彩评论