- (voID)tableVIEw:(UItableVIEw *)tableVIEw dIDSelectRowAtIndexPath:(NSIndexPath *)indexPath{ Nsstring *postID = [[parsedposts objectAtIndex:[indexPath indexAtposition:1]] objectForKey:@"post_ID"]; NSArray *IDParts = [postID componentsSeparatedByString:@"_"]; UIApplication *sharedApp = [UIApplication sharedApplication]; NSURL *faceBookURL = [NSURL URLWithString:[Nsstring stringWithFormat:@"fb://profile/%@",[IDParts objectAtIndex:0]]]; if([sharedApp canopenURL:faceBookURL]){ [sharedApp openURL:faceBookURL]; } else { NSURL *safariURL = [NSURL URLWithString:[Nsstring stringWithFormat:@"http://m.facebook.com/story.PHP?story_fbID=%@&ID=%@",[IDParts objectAtIndex:1],[IDParts objectAtIndex:0]]]; [sharedApp openURL:safariURL]; }}
一个不起作用的URL,但应该:fb:// post / 123456789_123456789
解决方法 如果这仍然是事情.首先,您需要按字符“_”分割您的帖子ID.
然后使用path:fb:// profile / {ID}其中{ID}将等于从split中获得的数组的第二部分.这适合我.
澄清:ID 123456_789789将成为一个数组= [123456,789789],然后您的网址将显示为此fb://个人资料/ 789789
总结以上是内存溢出为你收集整理的iOS:如何在我的应用程序中打开Facebook App中的特定帖子?全部内容,希望文章能够帮你解决iOS:如何在我的应用程序中打开Facebook App中的特定帖子?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)