Program received signal SIGABRT(节目接收信号 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)
函数.如果没有更多信息,就不可能准确地知道程序中发生了什么,但调用 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
的非调试版本中,标准库宏assert(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 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)
在几乎所有情况下,调试控制台都会为您提供更多关于导致 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:节目接收信号 SIGABRT
基础教程推荐
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01