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
}];
更新:我刚刚在params中注释了@“picture”键,现在我看到“Post to Wall”标题带有“Okay”按钮,但模态的内容显示“无法发布到用户的墙上”(实际上这是是随机的,有时会发生......大部分时间我仍然是空视图)
如果我删除@“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"
)>
答案 0 :(得分:0)
我发现了我的问题。我假设FBGraphUser
。id的类型为long long
,而不是NSString*
,所以我正在投射它并进行转换,这会产生无效的ID我猜...现在它显示正确。
猜猜我应该检查一下这个文档: https://developers.facebook.com/docs/reference/ios/3.0/protocol/FBGraphUser/