与Facebook连接

时间:2012-07-04 11:17:21

标签: iphone objective-c facebook

我在iphone中使用fbcoonect连接facebook。当我第一次登录时给出数据但是在退出facebook并用另一个帐户登录之后,也会给出上次给定的相同数据。 我的代码就像 -

- (void)session:(FBSession*)session didLogin:(FBUID)uid {
self.usersession =session;


NSString* fql = [NSString stringWithFormat:
                 @"select     uid,name,first_name,middle_name,last_name,birthday,email,pic_square from user where uid == %lld",self.usersession.uid];


[NSDictionary dictionaryWithObject:fql
                            forKey:@"query"];
[[FBRequest requestWithDelegate:self]
 call:@"facebook.fql.query" params:params];
NSLog(@"User with id %lld logged in.", uid);
self.post=NO;}

我也尝试使用此代码 -

 - (void)session:(FBSession*)session didLogin:(FBUID)uid {
self.usersession =session;
NSLog(@"User with id %lld logged in.", uid);
[self getFacebookName];}

- (void)getFacebookName {
NSString* fql = [NSString stringWithFormat:
                 @"select uid,name,first_name,middle_name,last_name,birthday,email,pic_square from user where uid == %lld",self.usersession.uid];


NSDictionary* params =
[NSDictionary dictionaryWithObject:fql
                            forKey:@"query"];
[[FBRequest requestWithDelegate:self]
 call:@"facebook.fql.query" params:params];
self.post=NO;   
}

但它有同样的错误。请给出解决方案。

0 个答案:

没有答案