-1
- (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:@[@"[email protected]"]];
[mailComposer setMessageBody:@"Google Maps Url:locationFormatter" isHTML:NO];
// Display Mail Composer
[self presentViewController:mailComposer animated:YES completion:nil];
}
Как вставить строку locationFormatter в MessageBody? Я надеялся, что это будет работать:Используйте строковую переменную в сообщении MFMailCopose
[mailComposer setMessageBody:@"%@",locationFormatter isHTML:NO];
Использование '' NSString' stringWithFormat: ':' [mailComposer setMessageBody: [NSString stringWithFormat: @ "% @", locationFormatter] isHTML : NO]; ' – Larme