2015/03/21

[iOS][Objective-C]AccountsFrameworkを使ったソーシャルサービスのログインについて

実は、下記のプログラムを実行した時に、countが0を返す時があるみたいです。

ACAccountStore *aCAccountStore = [[ACAccountStore alloc] init];
ACAccountType *aCAccountType = [aCAccountStore accountTypeWithAccountTypeIdentifier:(ACAccountTypeIdentifierTwitter || ACAccountTypeIdentifierSinaWeibo)];
[aCAccountStore requestAccessToAccountsWithType:aCAccountType withCompletionHandler:^(BOOL granted, NSError *error) {
    if (granted) {
        dispatch_async(dispatch_get_main_queue(), ^{
          NSArray *acAcounts = [aCAccountStore accountsWithAccountType:aCAccountType];
          NSUInteger count = [acAcounts count];
        });
    }else{
        NSLog(@"not grandted");
    }
}];
権限も許可されてエラーも特にないんだけど、いざ、アカウントの情報を取得しようとしたら0件だったという状況。

appleの審査でもこの状況を突っ込まれるので今後、注意していきたい。

0 コメント:

コメントを投稿