ACAccountStoreについて
ずっと下書きに残ってたので備忘録として残しときます。
作成しながら残して行ってるので誤りや不十分なところがあると思います。
(個人のメモなのですみません。随所訂正していきます)
ACAccountStore
http://developer.apple.com/library/ios/documentation/Accounts/Reference/ACAccountStoreClassRef/Reference/Reference.htm
プロパティは
NSArrayクラスのaccounts
インスタンスメソッドでTwitterやらFacebook用のアカウントを取得、保存するみたい。
- (NSArray *)accountsWithAccountType:(ACAccountType *)accountType メソッド
これでaccountTypeに
ACAccountType *accountType = [_accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter];
とTwitterとすることでTwitter用のACAccountType インスタンスの生成。
このインスタンス(アカウント)を使ってTwitterへのアクセスに使用する。
参考にした記事
2011/12/22 iOS5 で簡単に Twitter を利用する
http://yoo-s.com/topic/detail/454
実装の部分
ACAccountStore *accountStore = [[ACAccountStore alloc] init]; ACAccountType *accountType = [accountStore accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierTwitter]; NSArray *accounts = [NSArray array]; [accountStore requestAccessToAccountsWithType:accountType withCompletionHandler: ^(BOOL granted, NSError *error) { if (granted) { _accounts = [accountStore accountsWithAccountType:accountType]; } }];