【发布时间】:2011-03-16 07:16:32
【问题描述】:
使用https://github.com/facebook/facebook-ios-sdk,如何将照片发布到 Facebook 粉丝页面。而在此之前,如何让用户成为页面的粉丝(即喜欢)?
即使我搜索了许多网页,包括 stackoverflow,我也找不到路。 有的回答说不可能。 但如您所知,您可以在 Facebook 应用程序中完成这两件事。
[1] 发帖 只需发布文本即可,如以下代码。 153120444748228 是一个页面ID。
[_facebook requestWithGraphPath:@"153120444748228/feed"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
但我尝试用上述方法发布照片,但照片却贴在了我的墙上。
NSString *path = @"http://php.chol.com/~sssang/zbxe/files/attach/images/12637/068/015/%ED%8B%B0%EC%95%84%EB%9D%BC-%EC%A7%80%EC%97%B0.jpg";
NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Post a Picutre to a Fan Page", @"message",
img, @"source",
nil];
// post a picutre to a page
[_facebook requestWithGraphPath:@"153120444748228/photos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
[2] 成为页面的粉丝。 我试着像下面那样做,什么也没发生。 :(
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"http://www.facebook.com/pages/AlonesTest/153120444748228", @"url",
nil];
[_facebook requestWithGraphPath:@"153120444748228/likes"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
【问题讨论】: