Reputation: 513
Which is the line of code to open facebook and twitter displaying a given page?
tried with this for Facebook
NSURL *target = [[NSURL alloc] initWithString:@"fb://profile/WindyCityCrossFit"];
[[UIApplication sharedApplication] openURL:target];
but it just taks me to my news feed page. Twitter haven't given me any results either.
Upvotes: 0
Views: 1278
Reputation: 1446
Facebook:
NSURL *url = [NSURL URLWithString:@"fb://profile/130936560286785"];
[[UIApplication sharedApplication] openURL:url];
Twitter:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"twitter://user?screen_name=MyTwitterID"]];
Upvotes: 2
Reputation: 1588
This should get you to facebook, though I'm not sure about twitter.
NSString *urlString = <your url>;
NSString *title = <your message>;
NSString *shareUrlString = [NSString stringWithFormat:@"http://www.facebook.com/sharer.php?u=%@&t=%@", urlString , title];
shareUrlString = [shareUrlString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [[NSURL alloc] initWithString:shareUrlString];
[[UIApplication sharedApplication] openURL:url];
Upvotes: 0