Facebook iOS SDK 3.x feed dialog is gone?

泪湿孤枕 提交于 2019-11-30 03:28:06

问题


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 for some tutorials how I can show feed dialog using new sdk.

We used to write:

[facebook dialog:@"feed" andParams:params andDelegate:self];

But, it seems that all tips talking about dialogs are related to old SDK in developers.facebook.com.

Did anybody implemented feed dialog with new SDK?

Or, should we build our own DialogViewController to represent all UI elements as textFields, send button in order to make FBRequest?!


回答1:


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

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





and change:

#import <FacebookSDK/FacebookSDK.h>

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
                 }
             }
        }];



回答2:


With Facebook SDK 3.2, you don't need to import deprecated headers anymore. Web-based dialogs can be presented using the FBWebDialogs class:

[FBWebDialogs presentFeedDialogModallyWithSession:nil parameters:params handler:^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
    // ...
}];


来源:https://stackoverflow.com/questions/12122098/facebook-ios-sdk-3-x-feed-dialog-is-gone

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!