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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T21:25:40+00:00 2026-06-02T21:25:40+00:00

I am new to iOS development. I run into a problem where fbDidLogin is

  • 0

I am new to iOS development. I run into a problem where fbDidLogin is not being called when integrating the facebook API in my app. Everything works perfectly when i call the API from the main view controller (meaning, the one that the app delegate calls), but in my case, its under the settings view controller. I literally copy pasted the code from the main view controller (where it worked) to the setting view controller, where it doesnt work.

I did add this method to the app delegate which I understand is the issue for most people, but in my case, i think the problem is elsewhere…any help would be awesome.

- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
return [[settingsvc facebook] handleOpenURL:url];

}

Where in the app delegate header:

@property (strong, nonatomic) Settings *settingsvc;
  • 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-02T21:25:41+00:00Added an answer on June 2, 2026 at 9:25 pm

    A couple things.

    -You only need to implement fbDidLogin in one spot in your entire application. You do not implement it on each view controller that uses facebook.

    -Assuming you followed the Getting Started steps from Facebook’s iOS documentation, your Facebook object lives as a property of your app delegate. And your fbDidLogin method is only in your app delegate. This should also be the only spot in your code that declares the Facebook variable. That means that whenever you access facebook from anywhere else in your code, you do something like this:

    ProjectNameAppDelegate *appDelegate = (ProjectNameAppDelegate *)[UIApplication sharedApplication].delegate;
    [appDelegate.facebook someMethod];
    

    -Your handleOpenURL and openURL methods in your app delegate should look exactly like in the sample documentation from Facebook, not like the code you posted.

    -Personally I prefer to move the Facebook object out of the app delegate into a singleton helper class, but if you are a beginner then this is probably more advanced than you need.

    UPDATED INFORMATION ANSWERING COMMENTS:

    -someMethod is whatever Facebook method you are looking to call (post on the wall, authenticate, whatever)

    -You should put all FBSessionDelegate methods in your app delegate

    -You need to implement FBDialogDelegate on your view controller where you post to Facebook

    -Then in your view controller when you want to post to the user’s wall do something like this:

    - (void)postToWall {
        ProjectNameAppDelegate *appDelegate = (ProjectNameAppDelegate *)[UIApplication sharedApplication].delegate;
        if (appDelegate.facebook.isSessionValid) {
           //we're logged in so call the post dialog
           [self doPost:nil];
        } else {
            //we're not logged in so call the login and then do the post when it's done
            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(doPost:) name:@"FBLoginComplete" object:nil]; 
            NSArray *permissions = [[NSArray alloc] initWithObjects: 
                                     @"offline_access",
                                     @"publish_stream",
                                     nil];
            [appDelegate.facebook authorize:permissions];
            [permissions release];
    
        }
    }
    
    -(void)doPost:(NSNotification *) notification {
        ProjectNameAppDelegate *appDelegate = (ProjectNameAppDelegate *)[UIApplication sharedApplication].delegate;
        if (appDelegate.facebook.isSessionValid) {
            NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                           something, @"app_id",
                                           something, @"link",
                                           something, @"picture",
                                           something, @"name",
                                           something, @"caption",
                                           something, @"description",
                                           nil];
            [appDelegate.facebook dialog:@"feed" andParams:params andDelegate:self];
            [params release];
        } 
        [[NSNotificationCenter defaultCenter] removeObserver:self];       
    }
    

    -For the above to work, you need to post the NSNotificationCenter message “FBLoginComplete” whenever a login completes (success or fail).

    -Note: I wrote the above code without compiling it or testing it so it may not be perfect (but it usually is 🙂

    -Please note: you CANNOT post to a user’s wall directly without the dailog being popped up. The user always has the ability to edit the post before it hits their wall.

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

Sidebar

Related Questions

I'm new to iOS development and am running into an issue with my header
Hey i am new to iOS development, in my app i want to fetch
I am very new to iOS development, I have an app all set and
I'm fairly new to iOS development, and I'm starting work on an App that
I am quite new to IOS development, so forgive me if this problem turns
I'm new to iOS development, and I'm having a problem with reused view controllers.
i am new to iOS development i am working on an app which is
I am new to iOS development and I have started implementing the Facebook SDK
I am new in IOS development .Now i implement a UINavigationController to a UIViewController,
I am new to iOS development. I had created an iOS application. In my

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.