Upload an image on Facebook via FBConnect
I know many question has been post and answer for this question. I still stuck by a little thing.
I did success upload an UIImage
on Facebook via my iPhone app but I realize that photos goes to a pending album. And user had to accept it to get it post on their wall.
Here is my code
- (void)start
{
NSArray *permissions = [NSArray arrayWithObjects:
@"read_stream", @"offline_access", nil];
[_fbEngine authorize:kFbAppId
permissions:permissions
delegate:self];开发者_开发技巧
}
#pragma mark -
#pragma mark FBSession delegate
- (void)fbDidLogin
{
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
self.image, @"picture",
nil];
[_fbEngine requestWithMethodName:@"photos.upload"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
}
Is there a way to post a photo directly on the wall without passing by the pending album.
Regards,
KL94Add @"publish_stream"
to your list of requested permissions.
That'll let you push straight to their wall without an intermediate step. @"offline_access"
would allow you to do that via the graph api instead of with a FBDialog, too, so you could make the post happen entirely in the background.
精彩评论