0

I am using Facebook Sdk to get user data , I am getting all other user data instead of email - id , user's location and user's home town.

below here is the code which i have implemented.

-(void)facebookLogin
{
    NSArray *permissionsNeeded = @[@"basic_info",@"email",@"user_about_me",@"public_profile"];

    NSArray *permissions = @[@"user_birthday",@"user_hometown",@"user_location",@"email",@"basic_info"];
    loginView = [[FBLoginView alloc] initWithReadPermissions:permissions];

    loginView.frame = CGRectMake(42, 349, 115, 40);

    [self.view addSubview:loginView];

    loginView.delegate = self;      
}

-(void)loginViewFetchedUserInfo:(FBLoginView *)loginView user:(id<FBGraphUser>)user
{
    NSLog(@"%@", user);

    facebookID = [user objectForKey:@"email"];
}
kovpas
  • 9,553
  • 6
  • 40
  • 44

1 Answers1

0

can you try inside of loginViewFetchedUserInfo:user: the following

//id<FBGraphUser> user = (id<FBGraphUser>)result;
NSString * faceId = [user objectID];
NSLog(@"faceId:%@", faceId);
id<FBGraphPlace> fbPlace = [user location];
NSLog(@"fbPlace name:%@", [fbPlace name]);
id<FBGraphLocation> fbLocation = [fbPlace location];
NSString * userCity = [fbLocation objectForKey:@"city"];
NSLog(@"userCity:%@", userCity);
NSString * userCountry = [fbLocation country];
NSLog(@"userCountry:%@", userCountry);
NSString * userZip = [fbLocation objectForKey:@"zip"];
NSLog(@"userZip:%@", userZip);
NSString * birthday = [user birthday];
NSLog(@"birthday:%@", birthday);
NSString * email = [user objectForKey:@"email"];
NSLog(@"email:%@", email);
NSString * name = [user name];
NSLog(@"facebook name:%@", name);
aytunch
  • 1,326
  • 1
  • 16
  • 31
  • no its not working, actually the problem is that my facebookApp id is not able to fetch user location, hometown, profile pic.that's why everything is going null except email id and facebook name. – Angel Sharma Jan 05 '15 at 07:22