Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8688073
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:16:06+00:00 2026-06-12T23:16:06+00:00

thanks in advance every time I call to create an in app SMS i

  • 0

thanks in advance every time I call to create an in app SMS i get the following error…

Application tried to push a nil view controller on target .

This is the code I have that worked in OS 4 SDK…

MFMailComposeViewController *MailController;
MFMessageComposeViewController *SMScontroller;
NSError *error;
NSString *EmailMessage;
NSString *SubjectMessage;

-(IBAction)sendInAppSMS
{

    if([MFMessageComposeViewController canSendText])
    {
        SMScontroller = [[MFMessageComposeViewController alloc] init];
        SMScontroller.messageComposeDelegate = self;

        NSString *MessageString = @"Hello";

        SMScontroller.body = MessageString;

        SMScontroller.navigationBar.tintColor = [UIColor blackColor];

        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];

        [self presentModalViewController:SMScontroller animated:YES];

        [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackOpaque];
    }
    else{
        // alertView to tell user to setup a mail account. 
        NSString *message = [[NSString alloc] initWithFormat:@"To use this feature, you need to have an iPhone with SMS abilities."];
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"SMS Account Not Detected" message:message delegate:nil cancelButtonTitle:@"Understood" otherButtonTitles:nil];
        [alert show];
    }

}

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
    switch (result) {
        case MessageComposeResultCancelled:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"I Like It" message:@"User cancelled sending the SMS"
                                                           delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
            [alert show];
        }
            break;
        case MessageComposeResultFailed:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"I Like It" message:@"Error occured while sending the SMS"
                                                           delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
            [alert show];
        }
            break;
        case MessageComposeResultSent:
        {
            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"I Like It" message:@"SMS sent successfully..!"
                                                           delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
            [alert show];
        }
            break;
        default:
            break;
    }

    [self dismissModalViewControllerAnimated:YES];
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T23:16:08+00:00Added an answer on June 12, 2026 at 11:16 pm

    I believe if you are running this in the simulator you’ll get the error since it doesn’t have sms. I get the same error in simulator but if i connect to my phone it works fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Thanks in advance for your help. I have a need within an application to
Thanks in advance for your assistance. I have the following exported part: [Export (typeof(INewComponent))]
Thanks in advance for taking the time to read my question. I'm using MySQL
Thanks in advance to anyone who can think of a more efficient or a
thanks in advance for looking at this. Essentially, I'm calling didInsertElement() and binding an
Thanks in advance for any help you can provide on this issue! I manage
Thanks in advance for your help experts. I want to be able to copy
Thanks in Advance for reading and answer this question. I got button in asp
thanks in advance for reviewing my post. I've only been using jquery for about
Thanks in advance. This is my sample code. Whenever i try to run it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.