0

我试图使用 FBDialog 类在我的时间轴上发布图像。

我得到的最终网址为

https://m.facebook.com/dialog/feed?picture=file%3A%2F%2Flocalhost%2FUsers%2Fprakash%2FLibrary%2FApplication%2520Support%2FiPhone%2520Simulator%2F6.1%2FApplications%2F19C4DD7D-87C8-4CD7- ABE1-B64AC2D963F2%2FDocuments%2FUploadedImage.jpg&sdk=2&redirect_uri=fbconnect%3A%2F%2Fsuccess&app_id=446436425445989&display=touch

但收到以下错误消息:

发生错误。请稍后再试。API错误代码:100 API错误描述:无效参数错误信息:图片URL格式不正确

            UIImage *imge=[UIImage imageNamed:self.proSelectedImage];
            NSData *pngData = UIImagePNGRepresentation(imge);
            NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
            NSString *documentsPath = [paths objectAtIndex:0]; //Get the docs directory
            NSString *filePath = [documentsPath            stringByAppendingPathComponent:@"UploadedImage.jpg"];
            NSFileManager *fileManager = [NSFileManager defaultManager];
            [fileManager createFileAtPath:filePath contents:pngData attributes:nil];
            NSURL *url = [[NSURL alloc] initFileURLWithPath:filePath];
            filePath = [[NSBundle mainBundle] pathForResource:@"wildFlower" ofType:@"jpg"];
            NSLog(@"%@",filePath);
            NSString *file= [url absoluteString];

            FacebookManager *myFacebook = [FacebookManager sharedInstance];
            [myFacebook setDelegate:self];
            NSString *kAppId=[FacebookManager sharedInstance].appID;
            NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                           kAppId, @"app_id",
                                           file ,@"picture",
                                           nil];
          [[[FacebookManager sharedInstance] facebook] dialog:@"feed" andParams:params andDelegate:self];

如果我用谷歌的一些静态 url 替换文件路径,这段代码就可以正常工作。但每次我尝试从我的 iPhone 画廊上传时,它都会显示上述错误消息。

所以我只想获取本地(iPhone 画廊)图片网址。

4

1 回答 1

0

在 Facebook 的新规则和规定中,您不能在朋友的墙上发布任何内容,尽管您可以标记他们以显示在他们的墙上。请在 此处找到对您有益的链接。希望这可以帮助

于 2013-05-16T09:32:04.997 回答