开发者

iPhone : Posting an image to facebook's wall with comment message using oAuth support

开发者 https://www.devze.com 2023-03-13 01:17 出处:网络
Posting an image to facebook\'s w开发者_StackOverflow中文版all with comment message using oAuth support from the latest sdk provided by facebook.

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

精彩评论

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

关注公众号