I want to send pa开发者_StackOverflow社区rticular message to other people via email and sms option. the email portion work perfectly but i don't know how to pass a html string into message body.
for message, I am use MFMessageComposeViewControllerand the string is like
NSString *emailBody = [NSString stringWithFormat:@"<p>Map of %@</p><table><tbody><tr valign='top'><td><b>Place Name:</b></td><td>%@</td></tr><tr valign='top'><td><b>Country Name:</b></td><td>%@</td></tr><tr valign='top'><td><b>Area Name:</b></td><td>%@</td></tr><tr valign='top'><td><b>Latitude:</b></td><td>%@</td></tr><tr valign='top'><td><b>Longitude:</b></td><td>%@</td></tr><tr><td> </td><td> </td></tr></tbody></table>http://maps.google.com/maps?q=%@,%@</a><BR></BR>", [dict objectForKey:@"name"],[dict objectForKey:@"name"], [dict objectForKey:@"country"], [dict objectForKey:@"area"], [dict objectForKey:@"lat"], [dict objectForKey:@"long"],[dict objectForKey:@"lat"], [dict objectForKey:@"long"], [dict objectForKey:@"lat"],[dict objectForKey:@"long"]];
how to pass this string into setBody of message controller?
Are you sure you have assigned a delegate object to your MFMessageComposeViewController
instance?. The delegate must conform to the MFMessageComposeViewControllerDelegate
protocol.
To setup the initial content of the message use the body
property.
Here is an example:
MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;
picker.recipients = [NSArray arrayWithObject:@"48151623"];
picker.body = @"We either live together... or die alone.";
[self presentModalViewController:picker animated:YES];
[picker release];
精彩评论