i added [se开发者_如何学Clf fbButtonClick:nil]; , but it does't call login screen. Why?
- (void)viewDidLoad {
_facebook = [[Facebook alloc] initWithAppId:kAppId];
[self.label setText:@"Please log in"];
_getUserInfoButton.hidden = YES;
_getPublicInfoButton.hidden = YES;
_publishButton.hidden = YES;
_uploadPhotoButton.hidden = YES;
_fbButton.isLoggedIn = NO;
[_fbButton updateImage];
[self fbButtonClick:nil];
}
You're suppose to call the authorize
method on the _facebook object to login. That will call the login screen
i solved this problem with timer
NSTimer *timer = [[NSTimer timerWithTimeInterval:0.001
target:self
selector:@selector(timerFired:)
userInfo:nil
repeats:NO] retain];
[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
- (void)timerFired:(NSTimer *)timer
{
[timer invalidate];
[timer release];
timer = nil;
[self fbButtonClick:nil];
}
精彩评论