我正在开发一个使用 Facebook SDK 3.23.2 的现有项目。我正在尝试使用该FBDialogs
presentShareDialogWithParams
方法在 FB 墙上共享数据。共享对话框正在打开,但在发布数据时出现错误状态,我无法在墙上发布..
以下是我的代码:
FBLinkShareParams *params = [[FBLinkShareParams alloc] init];
params.link = [NSURL URLWithString:@"https://developers.facebook.com/ios"];
params.picture = [NSURL
URLWithString:@"https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png"];
params.name = @"Facebook SDK for iOS";
params.caption = @"Build great social apps and get more installs.";
if ([FBDialogs canPresentShareDialogWithParams:params])
{
NSLog(@"in app");
FBAppCall *call= [FBDialogs presentShareDialogWithParams:params clientState:nil handler:^(FBAppCall *call, NSDictionary *results, NSError *error) {
if(error) {
[ALToastView toastInView:self.view withText:@"error "];
// If there's an error show the relevant message
} else {
// Check if cancel info is returned and log the event
if (results[@"completionGesture"] &&
[results[@"completionGesture"] isEqualToString:@"cancel"]) {
[ALToastView toastInView:self.view withText:@"Inviting Via Facebook Cancelled"];
NSLog(@"User canceled story publishing.");
} else {
[ALToastView toastInView:self.view withText:@"Inviting Via Facebook success"];
// If the post went through show a success message
}
}
}];
该方法总是会if(error)
循环并将状态显示为错误。虽然当我尝试通过创建一个简单的新项目来使用它时,相同的方法正在工作,但它在我的应用程序中不起作用......提前致谢