我要找回我的系统帐户,这是我在设置应用程序中设置的Facebook的访问令牌。
我知道Social.framework(iOS6的)知道我所有的FB帐户信息,我可以进行API调用使用SLRequest类,想在这个岗位图形API http://blogs.captechconsulting.com/blog/eric-stroh/ios- 6教程整合Facebook的-你的应用程序
不过,我的问题是 - 我怎么能找回我的Facebook系统帐户的访问令牌?
我发现Twitter的解决方案https://dev.twitter.com/docs/ios/using-reverse-auth ,但你能帮助我与Facebook
如果你已经知道如何获得帐户存储设置,这里是它周围的代码展示了如何获得访问令牌:
@property (strong, nonatomic) ACAccountStore *accountStore;
@property (strong, nonatomic) ACAccount *fbAccount;
...
@synthesize accountStore = _accountStore;
@synthesize fbAccount = _fbAccount;
...
// Initialize the account store
self.accountStore = [[ACAccountStore alloc] init];
// Get the Facebook account type for the access request
ACAccountType *fbAccountType = [self.accountStore
accountTypeWithAccountTypeIdentifier:ACAccountTypeIdentifierFacebook];
// Request access to the Facebook account with the access info
[self.accountStore requestAccessToAccountsWithType:fbAccountType
options:fbInfo
completion:^(BOOL granted, NSError *error) {
if (granted) {
// If access granted, then get the Facebook account info
NSArray *accounts = [self.accountStore
accountsWithAccountType:fbAccountType];
self.fbAccount = [accounts lastObject];
// Get the access token, could be used in other scenarios
ACAccountCredential *fbCredential = [self.fbAccount credential];
NSString *accessToken = [fbCredential oauthToken];
NSLog(@"Facebook Access Token: %@", accessToken);
// Add code here to make an API request using the SLRequest class
} else {
NSLog(@"Access not granted");
}
}];