Reputation: 205
I am Working on an RSS app where it needs to send the url of the article through a message. I have this code so far,
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init] ;{
if([MFMessageComposeViewController canSendText])
{
controller.body = @"Check Out This Informtaion, %@", [NSURL URLWithString:self.feedItem[@"url"]];
controller.recipients = [NSArray arrayWithObjects: nil];
controller.messageComposeDelegate = self;
[self presentModalViewController:controller animated:YES];
}}
And it will work, it opens up the Messages in-app, but all it says in the message is
Check Out This Information, %@
When I do the same
[NSURL URLWithString:self.feedItem[@"url"]];
for opening up the page in Safari, it works, so that is correct, but I don't know how to fix it, please help.
Upvotes: 0
Views: 265
Reputation: 57149
This line:
controller.body = @"Check Out This Informtaion, %@", [NSURL URLWithString:self.feedItem[@"url"]];
is equivalent to
controller.body = @"Check Out This Informtaion, %@";
[NSURL URLWithString:self.feedItem[@"url"]];
…because the two statements are executing independently.
As user2056143 pointed out, you’re missing an NSString -stringWithFormat: around your values. I.e.:
controller.body = [NSString stringWithFormat:@"Check Out This Informtaion, %@", [NSURL URLWithString:self.feedItem[@"url"]]];
Upvotes: 2
Reputation: 11
Change body to :
controller.body = [NSString stringWithFormat:@"Check Out This <a href=\"%@\">Information<\a>", self.feedItem[@"url"]];
Upvotes: 1