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 7445789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T12:07:06+00:00 2026-05-29T12:07:06+00:00

I need to present a MFMessageComposeViewController after receiving a UILocalNotification . Right now I

  • 0

I need to present a MFMessageComposeViewController after receiving a UILocalNotification.

Right now I have a view controller let’s call it ViewControllerA which conforms to the MFMessageComposeViewControllerDelegate. In ViewControllerA I have setup the following method:

- (void)sendNow {

    MFMessageComposeViewController *mfMessageComposeVC = [[MFMessageComposeViewController alloc] init];

    if([MFMessageComposeViewController canSendText]) {

        DLog(@"Can send text");

        mfMessageComposeVC.recipients = self.numbers;
        mfMessageComposeVC.body = self.message;
        mfMessageComposeVC.messageComposeDelegate = self;
        [self presentModalViewController:mfMessageComposeVC animated:YES];
    }   
}

So when I receive a UILocalNotification from the AppDelegate I have setup the following method:

- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification {

    DLog(@"Notification Body: %@", notification.alertBody);
    DLog(@"%@", notification.userInfo);

    //application.applicationIconBadgeNumber = 0;

    UIApplicationState state = [application applicationState];
    if (state == UIApplicationStateInactive) {

        // Application was in the background when notification was delivered.

        ViewControllerA *vcA = [[ViewControllerA alloc] initWithNibName:nil bundle:nil];
        vcA.messageData = [NSArray arrayWithArray:self.messageData];    
        [vcA sendNow];

        //[remindersNavigationController pushViewController:reminderDetailsVC animated:NO];

    } else {

        // Application is currently running, Alert the user with a UIAlertView that he has scheduled a message to be sent at this time, give him the option of Close and Send
    }
}

The weird thing is that when running the app in the simulator it pops up a UIAlertView saying “this device cannot send text”. This behaviour is expected. But when running it on the device it goes inside the IF and logs “Can send text” but the MFMessageComposeViewController is never presented. I know in fact that the MFMessageComposeViewController will present itself properly in the app without using the UILocalNotification.

Basically just after receiving the notification and clicking “View” I want the MFMessageComposeViewController to be presented.

  • 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-05-29T12:07:08+00:00Added an answer on May 29, 2026 at 12:07 pm
        ViewControllerA *vcA = [[ViewControllerA alloc] initWithNibName:nil bundle:nil];
        vcA.messageData = [NSArray arrayWithArray:self.messageData];    
        [vcA sendNow];
    

    vcA – is not added (pushed) to nav controller or window or to something else.
    Do you have a nav controller variable in app delegate? use it

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

Sidebar

Related Questions

I need to present a modal view controller and be notified when it is
I need to present the user with a matrix of which one column is
I need to present a modal tab bar controller using interface builder. I'd like
I need to present some information in a table view where some information is
User is a model. I have 100 users. I need to present the list
I need present a grid-view in the web page, and based on the checkbox
I've a tableviewController in a class which I need to present modally from another
I have some data I need to present to a user in a very
I have a PHP application using CakePHP. I need to present a table showing
On both the iPhone and the iPad I have a need to present two

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.