Question

in htttps://developer.facebook.com they have give login with API call Sample, they asked to type following code in my app delegate.m file

// 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];
                                }];

it is showing me the error like ---- No visible @interface for 'AppDelegate' declares the 'sessionStateChanged:state:error:' thanks in advance...

Was it helpful?

Solution

According to above link, You have to add this method in your app delegate.. But you can customize this method according to your view by state(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...
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top