NSString *facebookIDString = [NSString stringWithFormat:@"%lld", facebookID];
// Put together the dialog parameters
NSMutableDictionary *params =
[NSMutableDictionary dictionaryWithObjectsAndKeys:
facebookIDString, @"to",
@"MY APP NAME", @"name",
@"MY APP CAPTION", @"caption",
@"MY APP DESCRIPTION", @"description",
@"http://www.myApp.com", @"link",
@"https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png", @"picture",
FACEBOOK_APP_ID, @"app_id",
nil];
// Invoke the dialog
[FBWebDialogs presentDialogModallyWithSession:[FBSession activeSession]
dialog:@"feed"
parameters:params
handler:
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) {
//My code here
}];
更新:我刚刚注释掉了参数中的@“picture”键,现在我看到一个带有“Okay”按钮的“Post to Wall”标题,但模式的内容显示“Cannot post to user's Wall”(实际上这是随机的并且有时会发生......大多数时候我仍然得到空视图)
如果我删除 @"to" 键,模态似乎可以按预期工作,将内容发布到我自己的墙上,但我想发布到朋友的墙上。
我认为这是一个权限问题,但我打印出 [FBSession activeSession] 并且我有 publish_stream
<FBSession: 0x146a72d0, state: FBSessionStateOpen, loginHandler: 0x146a77d0, appID: <My APP_ID>, urlSchemeSuffix: , tokenCachingStrategy:<FBSessionTokenCachingStrategy: 0x145c3b20>, expirationDate: 4001-01-01 00:00:00 +0000, refreshDate: 2014-02-22 18:14:14 +0000, attemptedRefreshDate: 0001-12-30 00:00:00 +0000, permissions:(
"create_note",
"basic_info",
"share_item",
"status_update",
"user_friends",
"publish_actions",
"publish_checkins",
"video_upload",
"publish_stream",
"photo_upload",
installed,
email,
"public_profile",
"user_birthday",
"user_location"
)>