1
我使用下面的代码登录使用FbConnect到FB:FbConnect:同时发布在用户的墙上和新闻源中?
- (IBAction)loginButtonClicked:(id)sender {
facebook = [[Facebook alloc] initWithAppId:@"355949667779777" andDelegate:self];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"FBAccessTokenKey"]
&& [defaults objectForKey:@"FBExpirationDateKey"]) {
facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
}
if (![facebook isSessionValid]) {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"user_likes",
@"read_stream",
@"publish_stream",
nil];
[facebook authorize:permissions];
[permissions release];
}
}
然后我用下面的代码发布到用户的墙:
- (IBAction)postToWallPressed:(id)sender {
SBJSON *jsonWriter = [[SBJSON new] autorelease];
// The action links to be shown with the post in the feed
NSArray* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys:
@"Get Started",@"name",@"http://m.facebook.com/apps/hackbookios/",@"link", nil], nil];
NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks];
// Dialog parameters
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"Testing VB", @"name",
@"Integrating Facebook in VB.", @"caption",
@"VB is a voice morphing app for videos.", @"description",
@"http://www.google.com/", @"link",
@"http://www.freeimagehosting.net/newuploads/49ncw.png", @"picture",
actionLinksStr, @"actions",
nil];
[facebook dialog:@"feed" andParams:params andDelegate:self];
}
该帖子的发布用户的墙罚款,但它不会在新闻源中发布。
我在这里做错了什么?
@“http://fbrell.com/f8.jpg” ==>我们不能在这里使用当地的形象? – 2012-05-03 13:11:40
我认为我们不能..但是即使让我们尝试获取本地图像的网址,并使用该网址,而不是那个。可能会工作..检查后,通知我.. – 2012-05-03 13:45:12