我想让Facebook登录" iOS中的功能。问题是[FBSession alloc]
无效。
[FBSession alloc]
有0X0000000
。
所以[[FBSession alloc] init]
崩溃了。为什么[FBSession alloc]
有0X00000
?
代码:
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[self updateView];
SLAppDelegate *appDelegate = [[UIApplication sharedApplication]delegate];
if (!appDelegate.session.isOpen) {
// create a fresh session object
appDelegate.session = [**[FBSession alloc]** init];
if (appDelegate.session.state == FBSessionStateCreatedTokenLoaded) {
// even though we had a cached token, we need to login to make the session usable
[appDelegate.session openWithCompletionHandler:^(FBSession *session,
FBSessionState status,
NSError *error) {
// we recurse here, in order to update buttons and labels
[self updateView];
}];
}
}
}