2014-02-19 40 views
0
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中的@「圖片」鍵,現在我明白了「塗鴉牆」標頭「好」按鈕,但該模式的內容說:「不能張貼到用戶的牆上「(實際上這是隨機的,有時發生...大多數時候我仍然得到空視圖)FBWebDialogs presentDialogModallyWithSession打開空白莫代爾

如果我刪除@」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

是什麼在你的處理器塊'result'&'error'的價值?嘗試:'NSLog(@「result:%d,error:%@」,result,[errors localizedDescription]);'在你的'handler'塊 –

+0

處理程序塊不會被調用,直到我通過點擊'X '在右上角。當我這樣做時,error = nil,resultURL = nil,result = 1(或FBWebDialogResultDialogNotCompleted) –

回答