title: Close SMS inapp window iOS 5.1
body: <p>I have an app that have an sendInAppSMS action inside it. It brings up a window with a pre entered body in the message. Problem is that pressing the cancel button doesn't work. If I press send it sends the message but doesn't close the window. So I have to close the app completely to get rid of it.</p>
  
  <p>Someone out there who might have run in to this before? Tried to search here but couldn't find a solution..</p>
  
  <p>Cheers!</p>
  
  <p>This is how my code looks like: </p>
  
  <pre><code>-(IBAction) sendInAppSMS:(id) sender
  {
      MFMessageComposeViewController *controller = [[[MFMessageComposeViewController alloc] init] autorelease];
      if([MFMessageComposeViewController canSendText])
      {
          CLLocation *location=[self findCurrentLocation];
          CLLocationCoordinate2D coordinae=[location coordinate];
          controller.body =[[NSString alloc] initWithFormat:@" Alarm!, call the senders number with latitude:%f longitude:%f",coordinae.latitude,coordinae.longitude]; ;
          controller.recipients = [NSArray arrayWithObjects:@"phonenumber1", @"phonenumber2", nil];
          [self presentModalViewController:controller animated:YES];
      }
  }
  </code></pre>
  
  <p>I'm learning by doing, so I don't expect answers but if you feel to help out, where do I put that it in this code?</p>