错误日志SIGABRT如何解决?

时间:2010-01-31 15:10:34

标签: iphone xcode

当我插入此代码时,如果我没有错误地处理事件会产生错误吗?

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
switch (result)
    {
        case MFMailComposeResultCancelled:
            URLCacheAlertWithError(@"Result: canceled");
            //message.text = @"Result: canceled";
            break;
        case MFMailComposeResultSaved:
            URLCacheAlertWithError(@"Result: saved");
            //message.text = @"Result: saved";
            break;
        case MFMailComposeResultSent:
            URLCacheAlertWithError(@"Result: sent");
            //message.text = @"Result: sent";
            break;
        case MFMailComposeResultFailed:
            URLCacheAlertWithError(@"Result: failed");
            //message.text = @"Result: failed";
            break;
        default:
            URLCacheAlertWithError(@"Result: not sent");
        //  message.text = @"Result: not sent";
            break;
    }
}

2010-01-31 22:07:05.638 iPortals[1678:207] *** -[NSCFString localizedDescription]: unrecognized selector sent to instance 0x38474
2010-01-31 22:07:05.643 iPortals[1678:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFString localizedDescription]: unrecognized selector sent to instance 0x38474'
2010-01-31 22:07:05.649 iPortals[1678:207] Stack: (
    844776241,
    843056877,
    844780055,
    844282517,
    844245696,
    20767,
    12345,
    807831445,
    807768071,
    807781201,
    844553639,
    807717485,
    844537573,
    851058789,
    851397973,
    844537573,
    851058789,
    851058693,
    851058647,
    851057969,
    851060293,
    851056221,
    851054649,
    851040559,
    851039143,
    848378745,
    844528685,
    844526429,
    848374975,
    848375147,
    850798447,
    850793587,
    9135,
    9068
)
terminate called after throwing an instance of 'NSException'
Program received signal:  “SIGABRT”.

1 个答案:

答案 0 :(得分:1)

这意味着您已将消息localizedDescription发送到0x38474的对象,该对象是类NSCFString的对象,不支持此消息。

您可能打算将此方法发送到另一个具有指针的对象,但不保留此(可能是自动释放的)对象。然后它被自动释放并向指针(变量名称)发送消息,但是其他一些方法已将对象放在同一地址。