1

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...

Peer Mohamed Thabib
  • 636
  • 2
  • 9
  • 29

1 Answers1

4

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...
}
Mani
  • 17,549
  • 13
  • 79
  • 100
  • mani where it is showing to add the above mentioned code i never saw the code. could you please point me in that document ? – Peer Mohamed Thabib Jan 27 '14 at 11:12
  • @PeerMohamedThabib Did you find it? search with this keyword. `Handling session state changes`. You can see the code. – Mani Jan 27 '14 at 11:45