tags:

views:

90

answers:

1

when i insert this code it will make an error how can i handle event without error?

- (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  A: 

This means that you have sent the message localizedDescription to an object at 0x38474 which is an object of class NSCFString which does not support this message.

You probably meant to send this method to another object that you have a pointer to, but did not retain this (probably autoreleased) object. It then got autoreleased and you send a message to the pointer (variable name), but some other method has placed an object at the same address.

Felix
i update some code for make that error at my postthank for your reply Felix
RAGOpoR
The above method looks fine. Could you post the function URLCacheAlertWithError.
Felix
i see i know i use wrong argument of URLCacheAlertWithErrorthat cause of errorthanks again Felix
RAGOpoR