开发者

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];
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜