まず第一に、私は Facebook SDK を使用したくないので、これを行うことができましたが、これは機能していますが、ユーザーのメールを取得する方法がわかりません。
ACAccountStore *account = [[ACAccountStore alloc] init];
ACAccountType *accountType = [account accountTypeWithAccountTypeIdentifier:accountTypeName];
NSDictionary *options;
if ( [accountTypeName isEqualToString:ACAccountTypeIdentifierFacebook]){
options = @{
ACFacebookAppIdKey: @"601517946570890"
,ACFacebookPermissionsKey: @[@"email"]
};
}
[account requestAccessToAccountsWithType:accountType options:options completion:^(BOOL granted, NSError *error)
{
if (granted == YES)
{
NSArray *arrayOfAccounts = [account accountsWithAccountType:accountType];
if ([arrayOfAccounts count] > 0)
{
_account = [arrayOfAccounts lastObject];
NSDictionary *dict = @{
@"name": [_account userFullName] == nil ? [_account username] : [_account userFullName],
@"account_id": [_account identifier],
@"email": @"??"
};
NSLog(@"account info: %@",dict);
}
}
}];
ACAccount にはユーザーの電子メールを返すプロパティがないため、SLRequest を介して行う必要があるかどうかを確認しようとしましたが、見つかりませんでした。
出来ますか?