Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>you have to use graph path to get user Information.</p> <pre><code>-(void)getEmailId { [facebook requestWithGraphPath:@"me" andDelegate:self]; } - (void)openSession { if (internetActive) { NSArray *permissions=[NSArray arrayWithObjects:@"read_stream",@"email",nil]; [FBSession openActiveSessionWithReadPermissions:permissions allowLoginUI:YES completionHandler: ^(FBSession *session, FBSessionState state, NSError *error) { [self sessionStateChanged:session state:state error:error]; }]; }else { UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"" message:@"Internet Not Connected" delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; } } #pragma mark- request delegate methods - (void)request:(FBRequest *)request didLoad:(id)result { NSLog(@"request did load successfully...."); // __block NSDictionary *dictionary=[[NSDictionary alloc] init]; if ([result isKindOfClass:[NSDictionary class]]) { NSDictionary* json = result; NSLog(@"email id is %@",[json valueForKey:@"email"]); NSLog(@"json is %@",json); [[NSUserDefaults standardUserDefaults] setValue:[json valueForKey:@"email"] forKey:@"fbemail"]; [self.viewController login:YES]; } } - (void)request:(FBRequest *)request didFailWithError:(NSError *)error { UIAlertView *alertView=[[UIAlertView alloc] initWithTitle:@"" message:@"Server not responding.." delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alertView show]; [self fblogout]; [self showLoginView]; NSLog(@"request did fail with error"); } - (void)sessionStateChanged:(FBSession *)session state:(FBSessionState) state error:(NSError *)error { switch (state) { case FBSessionStateOpen: { //state open action } // Initiate a Facebook instance facebook = [[Facebook alloc] initWithAppId:FBSession.activeSession.appID andDelegate:nil]; // Store the Facebook session information facebook.accessToken = FBSession.activeSession.accessToken; facebook.expirationDate = FBSession.activeSession.expirationDate; if (![[NSUserDefaults standardUserDefaults] valueForKey:@"fbemail"]) { [MBProgressHUD showHUDAddedTo:self.viewController.view animated:YES]; [self getEmailId]; } break; case FBSessionStateClosed: case FBSessionStateClosedLoginFailed: // Once the user has logged in, we want them to // be looking at the root view. [self.navController popToRootViewControllerAnimated:NO]; [FBSession.activeSession closeAndClearTokenInformation]; facebook = nil; [self showLoginView]; break; default: break; } [[NSNotificationCenter defaultCenter] postNotificationName:FBSessionStateChangedNotification object:session]; if (error) { UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error" message:error.localizedDescription delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alertView show]; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload