-(void)getFacebookSettingInfo
{
ACAccountStore *accountStore = [[ACAccountStore alloc] init] ;
ACAccountType *facebookAccountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
NSArray *facebookAccounts = [accountStore accountsWithAccountType:facebookAccountType];
// NSLog(@"facebookAccounts ==== >>> %@", facebookAccounts);
if([facebookAccounts count] > 0)
{
// ACAccount *facebookAccount = [facebookAccounts objectAtIndex:0];
NSMutableArray *faceBookAccount = [facebookAccounts objectAtIndex:0];
NSMutableArray *facebookProperties = [faceBookAccount valueForKey:@"properties"];
//NSLog(@"===== %@",facebookProperties);
NSString *facebookName = [facebookProperties valueForKey:@"ACPropertyFullName"];
fbUserLabel.text = facebookName;
NSString *facebookID = [facebookProperties valueForKey:@"uid"];
if(fbIdentifier == 10) //Gettin Image if identifer = 10
{
NSString *imageUrl = [[NSString alloc] initWithFormat: @"http://graph.facebook.com/%@/picture?type=large", facebookID];
NSURL *url = [NSURL URLWithString:imageUrl];
NSData *imageData = [NSData dataWithContentsOfURL:url];
[profilepicButton setBackgroundImage:[UIImage imageWithData:imageData] forState:UIControlStateNormal];
fbIdentifier = 0;
}
}
else
fbUserLabel.text = @"Undefined";
}
No comments:
Post a Comment