ACAccountStoreを使ってもFacebookはapi keyが必要だった・・。
Twitterの場合はapi keyを取得しなくても出来たんだけど、
Facebookは別でAPIkeyを取得してないといけない。
プロジェクトにURLスキームの設定も必要なのかも知れない・・。
便利になってるけどなってないっていうか~笑
下はコード
// ACAccountStoreはアカウントの情報を管理してくれる物
ACAccountStore* accountStore = [[[ACAccountStore alloc] init] autorelease];
// 取得したいAccountのタイプをセット
ACAccountType* accountType =
[accountStore accountTypeWithAccountTypeIdentifier: ACAccountTypeIdentifierFacebook];
__block NSArray* accountList_ = nil;
// このACFacebookAppIdKeyが必ず必要
NSDictionary* dic =
@{
ACFacebookAppIdKey : @"*****************"
};
// リクエストを送る
[accountStore requestAccessToAccountsWithType: accountType
options: dic
completion: ^(BOOL granted, NSError *error)
{
if(granted)
{
accountList_ = [accountStore accountsWithAccountType:accountType];
ACAccount* ac = [accountList_ objectAtIndex: 0];
NSLog(@"%@", [ac username]);
// 一度取得してからはidentifierさえ記憶しておけばいつでも取り出せる
ACAccount* abc = [accountStore accountWithIdentifier: [ac identifier]];
NSLog(@"%@", [abc username]);
}
else
{
NSLog(@"%@", [error localizedDescription]);
}
}];
Facebookは別でAPIkeyを取得してないといけない。
プロジェクトにURLスキームの設定も必要なのかも知れない・・。
便利になってるけどなってないっていうか~笑
下はコード
// ACAccountStoreはアカウントの情報を管理してくれる物
ACAccountStore* accountStore = [[[ACAccountStore alloc] init] autorelease];
// 取得したいAccountのタイプをセット
ACAccountType* accountType =
[accountStore accountTypeWithAccountTypeIdentifier: ACAccountTypeIdentifierFacebook];
__block NSArray* accountList_ = nil;
// このACFacebookAppIdKeyが必ず必要
NSDictionary* dic =
@{
ACFacebookAppIdKey : @"*****************"
};
// リクエストを送る
[accountStore requestAccessToAccountsWithType: accountType
options: dic
completion: ^(BOOL granted, NSError *error)
{
if(granted)
{
accountList_ = [accountStore accountsWithAccountType:accountType];
ACAccount* ac = [accountList_ objectAtIndex: 0];
NSLog(@"%@", [ac username]);
// 一度取得してからはidentifierさえ記憶しておけばいつでも取り出せる
ACAccount* abc = [accountStore accountWithIdentifier: [ac identifier]];
NSLog(@"%@", [abc username]);
}
else
{
NSLog(@"%@", [error localizedDescription]);
}
}];
iOS6の一番のお気に入り機能!!!
色々あるけれども、
個人的に1番の良いアップデートは・・・。
横に持った時のSafariのフールスクリーンモード!!!
今まで動画再生する時以外はwebを見る時はほとんど縦に持って使ってました。
横にすると画面がすごく狭く見えたので・・・。
でも上のバーと下のバーが消えるようになったので、横に持っても使えるようになりました!
これは前からすごく欲しかったです。
でも・・・・。
一つ疑問が・・・。
縦にした時もフールスクリーンが出来れば良いんですけど・・・。
なんでしてくれないんだろう・・。
個人的に1番の良いアップデートは・・・。
横に持った時のSafariのフールスクリーンモード!!!
今まで動画再生する時以外はwebを見る時はほとんど縦に持って使ってました。
横にすると画面がすごく狭く見えたので・・・。
でも上のバーと下のバーが消えるようになったので、横に持っても使えるようになりました!
これは前からすごく欲しかったです。
でも・・・・。
一つ疑問が・・・。
縦にした時もフールスクリーンが出来れば良いんですけど・・・。
なんでしてくれないんだろう・・。
涼しくなってきた!!
何となく久しぶりに書き込んでみます。
iPhoneのアメーバアプリで入力してますが、日本語の入力をローマ字入力でやろうと思ってiPhoneを横に持っても画面が横にならない。。
ので、テンキー入力で入力中。。
iPhoneからの投稿