Get Facebook access token from Social.framework(iOS6)

I need to retrieve Facebook access token of my system account, which I set in Settings application.

I know that Social.framework(iOS6) knows all my FB account information & I can perform API calls to Graph API using SLRequest class, like in this post

  • Load images into custom table view cell asynchronously
  • IBAction Button “Unrecognized Selector Sent to Instance” Error
  • NSJSONSerialization results in EXC_BAD_ACCESS
  • how to add ARC in between of project
  • XML into JSON conversion in iOS
  • Playing sound effect with no latency in Objective-C
  • But, my question is – how can I retrieve my Facebook system account’s access token?

    I found solution for Twitter , but could you help me with Facebook

    Solutions Collect From Internet About “Get Facebook access token from Social.framework(iOS6)”

    If you already know how to get the account store set up, here’s code around it showing how to get the access token:

    @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
    // Request access to the Facebook account with the access info
    [self.accountStore requestAccessToAccountsWithType:fbAccountType
                                            completion:^(BOOL granted, NSError *error) {
        if (granted) {
            // If access granted, then get the Facebook account info
            NSArray *accounts = [self.accountStore
            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");