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 7732167
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T06:39:48+00:00 2026-06-01T06:39:48+00:00

In my ViewController – (IBAction)loginBtn:(id)sender { facebook = [[Facebook alloc] initWithAppId:@231190276934148 andDelegate:self]; NSUserDefaults *defaults

  • 0

In my ViewController

- (IBAction)loginBtn:(id)sender 
{
    facebook = [[Facebook alloc] initWithAppId:@"231190276934148" andDelegate:self];

    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    if ([defaults objectForKey:@"FBAccessTokenKey"] && [defaults objectForKey:@"FBExpirationDateKey"]) {
        facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
        facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
}

    if (![facebook isSessionValid]) {
        NSArray *permissions = [[NSArray alloc] initWithObjects:
                            @"user_likes",
                            @"user_about_me",
                            @"user_photos",
                            @"friends_about_me",
                            @"friends_activities",
                            @"read_stream",
                            @"publish_stream",
                            nil];
        [facebook authorize:permissions];
    }

    NSLog(@"asdoiffijd");
}

- (IBAction)btnRequest:(id)sender 
{
    [facebook requestWithGraphPath:@"me/friends" andDelegate:self];
}

- (void)fbDidLogin
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
    [defaults setObject:[facebook expirationDate] forKey:@"FBExiprationDateKey"];
    [defaults synchronize];
    NSLog(@"fbDidLogin!");
}

In my appDelegate

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
    return [facebook handleOpenURL:url];
}

I think - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation should be called before the fbdidLogin but I can’t complete this part [facebook handleOpenURL:url];

in stackoverflow, [[controller facebook] handleOpenURL:url]; will resolve problem,
but i can’t do this. Any solution?

  • 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-06-01T06:39:50+00:00Added an answer on June 1, 2026 at 6:39 am

    In their documentation, they suggest that you need this in your app delegate.

    https://developers.facebook.com/docs/mobile/ios/build/

    When I first tried this, I putting it in another object that I use for interacting with Internet sources and it didn’t work. When I put it in my app delegate, it worked fine. I concluded that when they say “Modify the application delegate …”, they really mean the app delegate.

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

Sidebar

Related Questions

here's my code: ViewController *vc = [[ViewController alloc] initWithNibName:@TableView bundle:nil]; [self.navigationController presentModalViewController:vc animated:YES]; //[self
In my viewController.m I have this code: self.movie = [[myMovie alloc]init]; self.movie.name = @Iron
Showing a modal ViewController works fine: UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:myView]; [self.navigationController presentModalViewController:navController
ViewController *vcObj = [[ViewController alloc]init]; [UIView transitionFromView:self.view toView:vcObj.view duration:2 options:UIViewAnimationOptionTransitionCurlUp completion:^(BOOL finished) {}]; [self
in my ViewController I have a button: - (IBAction)drawLineClick:(id)sender { CGRect rect; rect.origin.x =
doing this in AppDelegate: viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil]; Is there any problem
I have a viewController called FirstViewController. In an IBAction i call another ViewController called
If ViewController 's view is set to MyView And ViewController maintains a pointer to
I have a viewController (Planner) that loads two view controllers (InfoEditor and MonthlyPlan) when
I have a custom viewController called SourceListViewController, and I'm adding it into a UINavigationController,

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.