2012-09-27 16 views
0

我正在使用下面的代碼。它將我帶到FB對話框,在那裏我授權應用程序,授權應用程序後,它將我帶回到我的應用程序。不過它絕不會在牆上發佈任何內容。IOS Fb牆貼的方法不起作用

任何想法是什麼錯?

- (void) login 
{ 
    AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 

    appDelegate.facebook = [[Facebook alloc] initWithAppId:@"MY_APP_ID" andDelegate:self]; 


    NSArray* permissions = [NSArray arrayWithObjects:@"publish_stream", nil]; 

    [appDelegate.facebook authorize:permissions]; 


    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
            @".", @"name", 
            @".", @"caption", 
            nil]; 

    /* 
    NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
    @".", @"name", 
    @"Build great social apps and get more installs.", @"caption", 
    @"The Facebook SDK for iOS makes it easier and faster to develop Facebook integrated iOS apps.", @"description", 
    @"https://developers.facebook.com/ios", @"link", 
    @"https://raw.github.com/fbsamples/ios-3.x-howtos/master/Images/iossdk_logo.png", @"picture", 
    nil]; 
    */ 

    // Invoke the dialog 
    [appDelegate.facebook dialog:@"feed" andParams:params andDelegate:self]; 


} 

回答

0

你應該做的是這樣的:

graphPath = @"me/feed"; 
[params setObject:@"link" forKey:@"type"]; 
[params setObject:pict forKey:@"picture"]; 
[params setObject:self.url forKey:@"link"]; 
[params setObject:self.message forKey:@"message"]; 
[params setObject:self.urlName forKey:@"name"]; 
[params setObject:self.caption forKey:@"caption"]; 
[params setObject:self.urlDescription forKey:@"description"]; 
[appDelegate.facebook requestWithGraphPath:graphPath andParams:params andHttpMethod:@"POST" andDelegate:self]; 
+0

我看不出有什麼區別,但仍不能工作:d –

+1

你在開玩笑吧?你沒看到我調用'requestWithGraphPath:graphPath andParams:params andHttpMethod:@「POST」andDelegate:self]'method?這是實際在你的牆上發佈帖子的方法 – Stas