iPhone : Posting an image to facebook's wall with comment message using oAuth support
Posting an image to facebook's w开发者_StackOverflow中文版all with comment message using oAuth support from the latest sdk provided by facebook. Please provide useful links.
Follow the instructions here to integrate the latest Facebook SDK and get a valid session: Facebook SDK for iOS Getting Started
There is a sample app included with the SDK to get you started as well.
Then in your code, do something like this, where "session" is declared
Facebook * session;
- (void) sendFacebookMessage:(NSString *) messageText withCaption:(NSString *) captionText) andImage:(UIImage *) image {
NSMutableDictionary *args = [[[NSMutableDictionary alloc] init] autorelease];
[args setObject:captionText forKey:@"caption"];
[args setObject:messageText forKey:@"message"];
[args setObject:UIImageJPEGRepresentation(image, 0.7) forKey:@"picture"];
[session requestWithMethodName:@"photos.upload" andParams:args ndHttpMethod:@"POST" andDelegate:self];
}
精彩评论