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

  • Home
  • SEARCH
  • 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 6084465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T11:31:31+00:00 2026-05-23T11:31:31+00:00

I just went through the Getting Started > Mobile Apps documentation on Facebook developers.

  • 0

I just went through the “Getting Started > Mobile Apps” documentation on Facebook developers. They provided the code to ask permission for accessing information but they don’t specify where that code is suppose to go.

Could you tell me where to put the code? Because I don’t want to put it in the wrong space.

The code I want to add:

NSArray* permissions =  [[NSArray arrayWithObjects:
     @"publish_stream", @"offline_access", nil] retain];

[facebook authorize:permissions delegate:self];

My appDelegate code:

#import "iOSTestAppDelegate.h"

@implementation iOSTestAppDelegate

@synthesize facebook;

@synthesize viewController=_ViewController;

@synthesize window=_window;

@synthesize managedObjectContext=__managedObjectContext;

@synthesize managedObjectModel=__managedObjectModel;

@synthesize persistentStoreCoordinator=__persistentStoreCoordinator;

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    // Override point for customization after application launch.
    [self.window makeKeyAndVisible];

    /* Step 2. Within the body of the application:didFinishLaunchingWithOptions: method create instance of the Facebook class using your app id */
    facebook = [[Facebook alloc] initWithAppId:@"********"];

    /* Step 3. Once the instance is created, check for previously saved access token information. */
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    if ([defaults objectForKey:@"FBAccessTokenKey"] 
        && [defaults objectForKey:@"FBExpirationDateKey"]) {
        facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
        facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
    }

    /* Step 4. Check for a valid session and if it is not valid call the authorize method which will both signin the user and prompt the user to authorize the app: */

    if (![facebook isSessionValid]) {
        [facebook authorize:nil delegate:self];
    }

    return YES;
}

/* Step 5. Add the application:handleOpenURL: method to the AppDelegate with a call to the facebook instance: */
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {

    return [facebook handleOpenURL:url]; 
}

/* Step 6. Implement the fbDidLogin method from the FBSessionDelegate implementation. In this method you will save the user's credentials specifically the access token and corresponding expiration date. */
- (void)fbDidLogin {
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
    [defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"];
    [defaults synchronize];

}
...
@end
  • 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-23T11:31:31+00:00Added an answer on May 23, 2026 at 11:31 am

    After allocate your facebook instance, you have to provide these permission for authorizing the facebook from the user_credentials. it means were getting these permission from the user who are login.

    facebook=[[Facebook alloc]initWithAppId:kAppId];
    
    _permissions =  [[NSArray arrayWithObjects:@"publish_stream",@"offline_access",nil]retain];
    
    [facebook authorize:_permissions delegate:self];
    

    Publish stream provides : Enables your app to post content, comments, and likes to a user’s stream and to the streams of the user’s friends. With this permission, you can publish content to a user’s feed at any time, without requiring offline_access. However, please note that Facebook recommends a user-initiated sharing model.

    Offline Access:
    Enables your app to perform authorized requests on behalf of the user at any time. By default, most access tokens expire after a short time period to ensure applications only make requests on behalf of the user when the are actively using the application. This permission makes the access token returned by our OAuth endpoint long-lived.

    Refer more details about permission here

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

Sidebar

Related Questions

I just went through solr wiki page for clustering. But i am not getting
I am new to developing apps for the iPhone. I just went through the
I just went through some MVC tutorials after checking this site out for a
I just went through a bunch of stuff trying to figure out how to
Just as the title says. As i went through different explanations for choices made
i am just getting started with ASP.NET MVC and i'm using NHibernate for my
I just went through the whole certificate/keychain/provisioning/appID/profile/DNA test process to get my app running
I didn't use LINQ to SQL in project, I just went through a hand-on
I just went through this tutorial: update-widget-in-onreceive-method (btw: would you propose any improvements to
went through the tutorial http://www.sohtanaka.com/web-design/facebook-style-footer-admin-panel-part-1/ and tried the same to make a fixed top

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.