i work with NSNotification and unfortunately i can not debug the selector. In my ViewController.m, in the viewdidload method i implement the NSNotifiaction call. Also in my ViewController.m I implement the selector. Unfortunately i can not debug the selector. Here is my code:
//Observe for the custom Notification regarding the session state change
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleFBSessionStateChangeWithNotification:)
name:@"SessionStateChangeNotification"
object:nil];
- (void)handleFBSessionStateChangeWithNotification:(NSNotification*)notififcation
{
//Get the session, state and error values from the notification`s userinfo dictionary
NSDictionary* userInfo = [notififcation userInfo];
FBSessionState sessionState = [[userInfo objectForKey:@"state"]integerValue];
NSError* error = [userInfo objectForKey:@"error"];
//Handle the session state
//The interesting states are the opened session, the closed session and the failed loggin
if(!error) {
//In Case not error, then check if the session is opened or closed
if (sessionState==FBSessionStateOpen) {
[FBRequestConnection startWithGraphPath:@"me"
parameters:@{@"fields":@"first_name,last_name,email"}
HTTPMethod:@"Get"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error) {
NSLog(@"result : %@",result);
}
else{
NSLog(@"%@",[error localizedDescription]);
}
}];
}
else if (sessionState==FBSessionStateClosed||sessionState==FBSessionStateClosedLoginFailed) {
//A session was closed or the login was failed. Update the UI accordingly
NSLog(@"the session is closed");
}
}
else {
//In case an error has occured
NSLog(@"Error: %@",[error localizedDescription]);
}
}