使用FB Messenger共享链接

时间:2015-03-10 02:10:45

标签: ios objective-c facebook

我正在尝试使用FB Messenger共享链接。当我尝试分享到Facebook的链接时,我一直收到错误。我搜索了一个答案,我找到的几个解决方案没有帮助,因为plist中的所有内容都是正确的。如果有人有任何建议,我会非常感激,一直试图解决这个问题。

错误:

Invalid use of FBAppCall, fb839771929379526 is not registered as a URL Scheme. Did you set 'FacebookUrlSchemeSuffix' in your plist?

代码:

    // Check if the Facebook app is installed and we can present
    // the message dialog
    FBLinkShareParams *params = [[FBLinkShareParams alloc] init];
    params.link = [NSURL URLWithString:filePath];
    params.name = @"My Video";


    // If the Facebook app is installed and we can present the share dialog
    if ([FBDialogs canPresentMessageDialogWithParams:params]) {
        // Enable button or other UI to initiate launch of the Message Dialog
        // Present message dialog
        [FBDialogs presentMessageDialogWithLink:[NSURL URLWithString:@"https://developers.facebook.com/ios"] handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {

            if(error) {
            // An error occurred, we need to handle the error
            // See: https://developers.facebook.com/docs/ios/errors
            NSLog([NSString stringWithFormat:@"Error messaging link: %@", error.description
            ]);
            } else {
            // Success
            NSLog(@"result %@", results);
            }
        }];
    }  else {
        // Disable button or other UI for Message Dialog
    }

}

0 个答案:

没有答案