Facebook iOS SDK 3.x feed dialog is gone?

前端 未结 2 1471
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-05 03:55

Today I started to use Facebook SDK 3.0 for iOS and I realized that there is no FBDialog class anymore. I\'ve searched developers.facebook.com

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-05 03:59

    I've found the answer here:
    Feed Dialog - Facebook Developers

    Using the same new SDK 3.x we must add deprecated headers into Frameworks:

    enter image description here

    enter image description here

    and change:

    #import

    to

    #import "Facebook.h"


    EDIT (26.02.2013):

    Thanks to Andreas, he mentioned in comment, using new SDK 3.2 doesn't required you include deprecated classes anymore:

    Improved Web dialog support: This release adds support for integrating Web dialogs, feed dialog, and requests dialog, without invoking deprecated headers, making it cleaner and easier to add dialogs into your app.

    Example:

    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
         @"", @"name",
         @"", @"caption",
         @"", @"description",
         @"https://website.com/share", @"link",
         @"http://website.com/iossdk_logo.png", @"picture",
         nil];
    [FBWebDialogs presentFeedDialogModallyWithSession:nil
                                           parameters:params
                                              handler:
             ^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
                 if (error) {
                     // Error launching the dialog or publishing a story.
                     NSLog(@"Error publishing story.");
                 } else {
                     if (result == FBWebDialogResultDialogNotCompleted) {
                         // User clicked the "x" icon
                         NSLog(@"User canceled story publishing.");
                     } else {
                         // Handle the publish feed callback
                     }
                 }
            }];
    

提交回复
热议问题