iphone – 从iOS中的ACAccountStore获取Facebook uid?

iphone – 从iOS中的ACAccountStore获取Facebook uid?,第1张

概述嗨,我想从iOS 6中的ACAccountStore获取Facebook用户的UID self.accountStore = [[ACAccountStore alloc]init]; ACAccountType *FBaccountType= [self.accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIde 嗨,我想从iOS 6中的ACAccountStore获取Facebook用户的UID

self.accountStore = [[ACAccountStore alloc]init];    ACAccountType *FBaccountType= [self.accountStore accountTypeWithAccountTypeIDentifIEr:ACAccountTypeIDentifIErFacebook];    Nsstring *key = @"01234567890123";    NSDictionary *dictFB = [NSDictionary dictionaryWithObjectsAndKeys:key,ACFacebookAppIDKey,@[@"email"],ACFacebookPermissionsKey,nil];        [self.accountStore requestAccesstoAccountsWithType:FBaccountType options:dictFB completion:         ^(BOol granted,NSError *e) {             if (granted) {                 NSArray *accounts = [self.accountStore accountsWithAccountType:FBaccountType];                 //it will always be the last object with single sign on                 self.facebookAccount = [accounts lastObject];                 //i Want to get the Facebook UID and log it here                 NSLog(@"facebook account =%@",self.facebookAccount);             } else {                 //Fail gracefully...              NSLog(@"error getting permission %@",e);             }         }];

self.facebookAccount有UID,但我无法得到它

解决方法 我想获得UID而不使用Facebook API.可以使用以下方法完成

self.accountStore = [[ACAccountStore alloc]init];    ACAccountType *FBaccountType= [self.accountStore accountTypeWithAccountTypeIDentifIEr:ACAccountTypeIDentifIErFacebook];    Nsstring *key = @"01234567890123";    NSDictionary *dictFB = [NSDictionary dictionaryWithObjectsAndKeys:key,NSError *e) {             if (granted) {                 NSArray *accounts = [self.accountStore accountsWithAccountType:FBaccountType];                 //it will always be the last object with single sign on                 self.facebookAccount = [accounts lastObject];                 //i  got the Facebook UID and logged it here (ANSWER)                  NSLog(@"facebook account =%@",[self.facebookAccount valueForKeyPath:@"propertIEs.uID"]);             } else {                 //Fail gracefully...              NSLog(@"error getting permission %@",e);             }         }];
总结

以上是内存溢出为你收集整理的iphone – 从iOS中的ACAccountStore获取Facebook uid?全部内容,希望文章能够帮你解决iphone – 从iOS中的ACAccountStore获取Facebook uid?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1057702.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存