I've set up Facebook connect with my app using the demo project provided by Facebook. Everything works great, except for the last little step…
-
First of all, I login and get permissions.
-
Next, I upload a picture. This works great, I can see the picture in my Facebook album like I should be able to.
-
When this picture is uploaded, I get it's URL (returned by the FBRequest delegate). Copy pasting this URL into a web browser takes me directly to the image, so I know that this URL is correct.
Here's where the problem is:
- I now want to present this picture alongside a wall post. The wall post is fine, but the picture just doesn't seem to attach and the status is left as a plain text message.
Here's the code I'm using for the last part:
- (void)request:(FBRequest *)request didLoad:(id)result {
NSString* picUrl = [result objectForKey:@"src_big"]; //this definitely returns the right URL
if (picUrl)
{
NSString *message = @"Test status";
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
message, @"message", picUrl, @"picture", @"Look at my photo", @"name", nil];
[facebook requestWithMethodName:@"facebook.Stream.publish" andParams:params
andHttpMethod:@"POST" andDelegate:self];
}
}
Any ideas what I'm missing or doing wrong?
Best Answer
Fixed with the following code (after a lot of failed attempts). Facebook doesn't like the way I was trying it, you've got to do it all in just one step: