2012-04-02 86 views
0

我有一个iOS应用需要将图片发布到人们的墙上。Facebook:无法发布图片供稿

我要做的就是上传图片到用户的相册,获取图像的链接,并将其发布到用户的墙像这样:

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
             kAppId, @"app_id", 
             imageLink, @"link", 
             thumbURL, @"picture", 
             toUserId, @"to", 
             nil]; 

     [facebook dialog:@"feed" andParams:params andDelegate:self]; 

而且我得到以下错误:“FBCDN image is not allowed in stream...

当我使用我的开发人员用户名登录时,但使用其他用户名(我除了DEV用户名之外还测试了除管理FB应用程序的DEV用户名以外的每个用户名),它都不会发生。

+0

请使用图形API为 http://stackoverflow.com/questions/3152413/posting-picture-on-facebook-feed-from-an-iphone-app-using-graph-api – priyanka 2012-04-02 13:37:03

+0

我使用图表API ... – Alex1987 2012-04-02 13:38:44

+0

审查链接。它会为你工作。 – priyanka 2012-04-02 13:40:26

回答

3
+0

谢谢你。完美工作! – Alex1987 2012-04-03 08:15:58

+0

这似乎没有工作更多..想法? – 2012-12-31 14:45:16

+0

至于我“object_attachment”不能正常工作。请参阅http://stackoverflow.com/a/23199781/989896链接查看我的解决方案 – Alena 2014-04-21 14:58:03

0

这里尝试使用我的功能。它的工作,我

- (void) uploadImageWithName : (NSString*)name 
{ 

    UIImage *uploadImage = [UIImage imageNamed:name]; 

    NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
           @"some text", 
           @"message", 
           [fb accessToken], 
           @"access_token",nil]; 

    [params setObject:uploadImage forKey:@"source"]; 

    [fb requestWithGraphPath:@"me/photos" 
         andParams: params 
        andHttpMethod: @"POST" 
         andDelegate:self]; 

} 

好运。

0

您需要拥有“publish_stream”权限才能上传照片。