打开facebook和twitter显示给定页面的代码行是什么?
在Facebook上尝试过
NSURL *target = [[NSURL alloc] initWithString:@"fb://profile/WindyCityCrossFit"]; [[UIApplication sharedApplication] openURL:target];
但它只会把我带到我的新闻订阅页面。Twitter也没有给我任何结果。
发布于 2013-04-27 11:06:09
Facebook:
NSURL *url = [NSURL URLWithString:@"fb://profile/130936560286785"]; [[UIApplication sharedApplication] openURL:url];
推特:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"twitter://user?screen_name=MyTwitterID"]];
发布于 2013-04-27 09:59:34
这应该会让你访问facebook,尽管我不确定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];https://stackoverflow.com/questions/16247328
复制相似问题