IOS: How to open a specific post in a Facebook application from my application?

I can easily link a specific Facebook post when Safari opens the URL, but I still have to find a way to open this post in the Facebook application. The Facebook app only displays the last three posts before the user needs to click “More posts.” So it's a little hard to find the message they are interested in. Now this is my code that allows users to link to the exact post in Safari, but not if the Facebook application is installed.

- (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 that does not work, but should: fb: // post / 123456789_123456789

+4
source share
1 answer

If this is something else.

-, "_".

path: fb://profile/{id}, {id} , . .

: ID 123456_789789 = [123456,789789], url : fb://profile/789789

+1

All Articles