Note that there are some explanatory texts on larger screens.

plurals
  1. POUnrecognized selector sent to instance error from Utility App navigation controller view
    primarykey
    data
    text
    <p>I have a utility app. I've implemented this code on the flipside, which calls a Feedback view to send an email, like this <a href="http://www.iostipsandtricks.com/using-apples-mail-composer/" rel="nofollow noreferrer">tutorial</a>. This works, but then when I click on the Send Feedback UIButton, my app immediately crashes with <code>*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController sendMail]: unrecognized selector sent to instance 0x89c1960'.</code></p> <p>I've checked these things:</p> <p>I've declared the delegate properly and implemented it for the MailComposer.</p> <p>My method, sendMail, is wired to the TouchUp Event for the button.</p> <p>My method names agree:</p> <pre><code>- (IBAction)sendMail; </code></pre> <p>and</p> <pre><code>- (IBAction)sendMail { if ([MFMailComposeViewController canSendMail]) { MFMailComposeViewController *mfViewController = [[MFMailComposeViewController alloc] init]; mfViewController.mailComposeDelegate = self; [self presentModalViewController:mfViewController animated:YES]; } else { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Status:" message:@"Your phone is not currently configured to send mail." delegate:nil cancelButtonTitle:@"ok" otherButtonTitles:nil]; [alert show]; } </code></pre> <p>}</p> <p>The code doesn't event get to this method because I have a breakpoint set at the top of the method implementation but doesn't get called. Nor did a breakpoint at ViewDidLoad get activated.</p> <p>Looking at this error closely:</p> <pre><code>reason: '-[UIViewController sendMail]: unrecognized selector sent to instance </code></pre> <p>it seems it is expecting a view controller named sendMail rather than a method. I read this <a href="https://stackoverflow.com/questions/5843217/unrecognized-selector-sent-to-instance">post</a> which seems very similar but I dont' see any other view controller names in the xib Identity drop down list. I think this is part of my problem but I'm not sure how to fix it.</p> <p>Maybe I'm supposed to be presenting the MFMailComposer via a viewcontroller? If so, I'm not sure how to do that.</p> <p>Any suggestions would be appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload