我正在申请读者,可以向Facebook发送文字。 但我在另一页完成了对Facebook的标识。 我有一个叫做textpostingbt
和一份载有案文的案文概览。 我需要做的是,当用户利用 but子把案文张贴到Facebook时,却不展示 log。 我在纽伦有了一些验证,因此,只有用户在。
EDIT:
- (IBAction)postGradesTapped:(id)sender {
//_posting = YES;
// If we re not logged in, log in first...
if (![_session isConnected]) {
self.loginDialog = nil;
_loginDialog = [[FBLoginDialog alloc] init];
[_loginDialog show];
_logoutButton.hidden = YES;
}
// If we have a session and a name, post to the wall!
//else if (_facebookName != nil) {
//[self postToWall];
//}
// Otherwise, we don t have a name yet, just wait for that to come through.
}
- (IBAction)logoutButtonTapped:(id)sender {
[_session logout];
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"FB_logged"];
_btnFacebookmain.enabled =NO;
}
#pragma mark FBSessionDelegate methods
- (void)session:(FBSession*)session didLogin:(FBUID)uid {
[self getFacebookName];
}
- (void)session:(FBSession*)session willLogout:(FBUID)uid {
_logoutButton.hidden = YES;
_facebookName = nil;
}
#pragma mark Get Facebook Name Helper
- (void)getFacebookName {
NSString* fql = [NSString stringWithFormat:
@"select uid,name from user where uid == %lld", _session.uid];
NSDictionary* params = [NSDictionary dictionaryWithObject:fql forKey:@"query"];
[[FBRequest requestWithDelegate:self] call:@"facebook.fql.query" params:params];
}
#pragma mark FBRequestDelegate methods
- (void)request:(FBRequest*)request didLoad:(id)result {
if ([request.method isEqualToString:@"facebook.fql.query"]) {
NSArray* users = result;
NSDictionary* user = [users objectAtIndex:0];
NSString* name = [user objectForKey:@"name"];
self.facebookName = name;
_logoutButton.hidden = NO;
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"FB_logged"];
[_logoutButton setTitle:[NSString stringWithFormat:@"Facebook: Logout as %@", name] forState:UIControlStateNormal];
/*if (_posting) {
[self postToWall];
_posting = NO;
}*/
}
}