在 iOS6 中,我正在使用在这里发布消息,ACAccountType and SlRequest
但 d=为此我需要检索访问令牌以进行某些操作,
以下是我用来获取数据的代码
ACAccountType *FBaccountType= [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
// Specify App ID and permissions
NSDictionary *dictFB = @{
ACFacebookAppIdKey:kAppId,
ACFacebookPermissionsKey: @[@"email",@"publish_stream", @"publish_actions"],
ACFacebookAudienceKey: ACFacebookAudienceFriends
};
[accountStore requestAccessToAccountsWithType:FBaccountType options:dictFB completion:
^(BOOL granted, NSError *e) {
if (granted) {
NSArray *accounts = [accountStore accountsWithAccountType:FBaccountType];
// it will always be the last object with single sign on
facebookAccount = [accounts lastObject];
NSLog(@"facebook account = %@",facebookAccount);
} else {
//Fail gracefully...
NSLog(@"error getting permission %@",e);
}
}];
但从上面的代码中,我只得到以下数据 1]type 2]account description 3]username 4]objectid 5]properties 6]parent account
如何在 ios6 中使用上述代码获取访问令牌