// Whenever a person opens the app, check for a cached session
if (FBSession.activeSession.state == FBSessionStateCreatedTokenLoaded) {
// If there's one, just open the session silently, without showing the user the login UI
[FBSession openActiveSessionWithReadPermissions:@[@"basic_info"]
allowLoginUI:NO
completionHandler:^(FBSession *session, FBSessionState state, NSError *error) {
// Handler for session state changes
// This method will be called EACH time the session state changes,
// also for intermediate states and NOT just when the session open
[self sessionStateChanged:session state:state error:error];
}];
它向我显示错误,如'不可见@interface'AppDelegate'声明'sessionStateChanged:state:error:' 提前谢谢......
答案 0 :(得分:4)
根据上面的链接,您必须在您的app委托中添加此方法..但您可以根据您的状态视图自定义此方法(state == FBSessionStateOpen ... etc)
// This method will handle ALL the session state changes in the app
- (void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state error:(NSError *)error
{
// If the session was opened successfully
// customize your code...
}