ios - Use a string variable in MFMailCopose Message -


this question has answer here:

 - (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 insert locationformatter string in messagebody? hoping work:

[mailcomposer setmessagebody:@"%@",locationformatter ishtml:no]; 

try:

[mailcomposer setmessagebody:[nsstring stringwithformat:@"google maps url:%@", locationformatter] ishtml:no]; 

Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -