Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4552800
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:51:01+00:00 2026-05-21T16:51:01+00:00

As described in the README for facebook-ios-sdk, my app calls Facebook#authorize:delegate: before performing any

  • 0

As described in the README for facebook-ios-sdk, my app calls Facebook#authorize:delegate: before performing any API calls.

This method requires the user to authenticate (either in the Facebook app or in Safari) and then drops control back to my iPhone app. The problem is it asks the user to authenticate every time I call the method. If they’ve already granted permission to my app, they get a message saying that the app is already authorized and they have to press Okay to go back to my app. It doesn’t look very professional.

So I have two questions:

  1. Does the user always have to reauthorize in order to make Facebook calls? I always thought it would save the access token somewhere, maybe in the user defaults, so that you wouldn’t need to reauthorize.

  2. If the user doesn’t have to reauthorize every time, is there a way to check if my app already has permission, so the user doesn’t have to see that message and press Okay?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T16:51:02+00:00Added an answer on May 21, 2026 at 4:51 pm

    It’s unfortunate that the Facebook SDK doesn’t automatically handle it for us. Aside from building it into the SDK yourself, the easiest way is as such:

    Each time you allocate _facebook:

    _facebook = [[Facebook alloc] initWithAppId:@"SuperDuperAppID"];
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    NSString *accessToken = [prefs stringForKey:@"facebook-accessToken"];
    NSString *expirationDate = [prefs stringForKey:@"facebook-expirationDate"];
    _facebook.accessToken = accessToken;
    _facebook.expirationDate = expirationDate;
    

    If you’ve never saved anything in the NSUserDefaults, then nil values will be set. Nothing’s happened. Otherwise, true values will be set, and [_facebook isSessionValid]; should return TRUE, indicating good values. Go ahead and make Facebook SDK calls as if they are logged in (which they are). If false, then call

    [facebook authorize:permissions delegate:self]; 
    

    as usual.

    Then make sure to support the following Facebook delegate method:

    - (void)fbDidLogin {
    NSString *accessToken = _facebook.accessToken;
    NSString *expirationDate = _facebook.expirationDate;
    NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults];
    [prefs setObject:accessToken forKey:@"facebook-accessToken"];
    [prefs expirationDate forKey:@"facebook-expirationDate"];
    [prefs synchronize];
    }
    

    I use this code in my app, and it works perfectly. I did this from memory, so I apologize if it doesn’t work on copy-and-paste. There might be a mistype somewhere, plus improper memory management. Don’t forget that access tokens expire unless you get offline permission. In any case the code above handles everything.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

as described in http://developers.facebook.com/docs/api#publishing i want to make a post request to update a
As described on http://api.jquery.com/live/ : As of jQuery 1.7, the .live() method is deprecated.
Like described in the title, I want to open a native ios viewcontroller when
Like described in the docs.. http://download1.parallels.net/Plesk/PP10/10.2.0/Doc/en-US/online/plesk-api-rpc/index.htm?fileName=53497.htm It should be possible to change the home-location
The algorithm is described in this paper: Thread Scheduling for Multiprogrammed Multiprocessors . Briefly,
This is the problem described in Programming pearls . I can not understand binary
I have followed steps, described in rack-recaptcha readme . I have done all the
As described in the title, I have an app with two UILabels under each
This question is best described by a picture I think. I hope someone can
As described in one of the answers to SO question Any way to use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.