0
  1. how to open MFmessageComposeviewcontroller on any view controller (topviewcontroller) from NSObject class method excute in background.

    This is my code which popup massage controller without error

    MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
    
    if([MFMessageComposeViewController canSendText])
    {
        controller.body = @"Check out FundooSpace for mobile. Download it now from www.lsaknlansc.cas.kasjla/FundooSpace/d";
        controller.recipients=(NSArray *)passa;
        passa=nil;
        AppDelegate *appDelegateObject1 = (AppDelegate *)[[UIApplication sharedApplication] delegate];
    controller.messageComposeDelegate=self;
        [appDelegateObject1.navigationCntr.topViewController performSelectorOnMainThread:@selector(presentModalViewController:animated:) withObject:controller waitUntilDone:NO];
    }
    

But 1 after send or cancel button clicked then it get crash.
2. The delegate method is not called (how to set delegate to message controller)

Gabriel.Massana
  • 8,165
  • 6
  • 62
  • 81
Mahesh
  • 317
  • 1
  • 3
  • 17

1 Answers1

1

I think the NSObject running in background is released. It is also the delegate for the Compose View Controller, so the fatal error: EXC BAD ACCESS. The property messageComposeDelegate doesn't retain the object. You are using ARC, aren't you?

Try to retain the object assigning it to any strong var until the compose view controller ends.

Gabriel
  • 3,319
  • 1
  • 16
  • 21
  • there is one problem occurs when i create ipa file and install on device then it get crash (wait_fences: failed to receive reply: 10004003). but run in Xcode with device then it work fine.please suggest me why this happen? – Mahesh Apr 23 '13 at 10:58
  • That is a very different problem. Please, open a new Question. – Gabriel Apr 23 '13 at 11:29