0
 - (IBAction)sendButton:(id)sender {

NSString *locationFormatter = [NSString stringWithFormat:@"https://maps.google.com?saddr=Current+Location&daddr=%f,%f", self.locationManager.location.coordinate.latitude, self.locationManager.location.coordinate.longitude];

if ([MFMailComposeViewController canSendMail]){

    MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc]init];
    mailComposer.mailComposeDelegate = self;
    [mailComposer setSubject:@"Google Maps Directions"];
    [mailComposer setToRecipients:@[@"castro.michael87@gmail.com"]];
    [mailComposer setMessageBody:@"Google Maps Url:locationFormatter" isHTML:NO];

    // Display Mail Composer
    [self presentViewController:mailComposer animated:YES completion:nil];
}

How do I insert the locationFormatter string in the MessageBody? I was hoping this would work:

[mailComposer setMessageBody:@"%@",locationFormatter isHTML:NO];
Larme
  • 18,203
  • 5
  • 42
  • 69
Michael Castro
  • 194
  • 2
  • 12
  • 1
    Use `NSString` `stringWithFormat:` : `[mailComposer setMessageBody:[NSString stringWithFormat:@"%@",locationFormatter] isHTML:NO];` – Larme Jul 23 '15 at 20:54

1 Answers1

0

Try:

[mailComposer setMessageBody:[NSString stringWithFormat:@"Google Maps Url:%@", locationFormatter] isHTML:NO];
williamb
  • 943
  • 1
  • 11
  • 32