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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T17:19:03+00:00 2026-05-30T17:19:03+00:00

I was wondering what the best practice guidelines are for using the Facebook iOS

  • 0

I was wondering what the “best practice” guidelines are for using the Facebook iOS SDK.

Specifically – I have several forms that use the Facebook SDK.
My initial instinct as an OOP programmer was to create a “FacebookManager” class under my data-access-layer which handles all Facebook activity.
Unfortunately since Facebook iOS SDK uses delegates and async methods, this is not so helpful since any other module using FacebookManager would have to pass in delegates for all responses anyway.

Then I figured that each ViewController would be a FBRequestDelegate by itself and handle all Facebook responses.

So, how do you do it in your app?

  • 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-30T17:19:04+00:00Added an answer on May 30, 2026 at 5:19 pm

    What I’ve done is to create a FacebookManager as you suggested. This manager becomes the FBRequestDelegate. Now I prefer blocks to the delegation model so all my FacebookManager methods are block based.

    Here is what my post to a user’s wall method looks like

    - (void)postToUserWall:(NSDictionary*)postDictionary withCompleteHandler:(void(^)(id result, NSError* error))block {
    
    
      if( [facebook_ isSessionValid] ) {
        NSMutableDictionary* params = [postDictionary mutableCopy];
        [params setObject:facebook_.accessToken forKey:@"access_token"];
        FBRequest* request = [facebook_ requestWithGraphPath:@"me/feed" andParams:[postDictionary mutableCopy] andHttpMethod:@"POST" andDelegate:self];
        [[request params] setObject:block forKey:@"result"];
      }
    
    }
    

    Then on a success or error I just execute the block

    - (void)processRequest:(FBRequest*)request withResult:(id)result andError:(NSError*)error {
      NSDictionary* params = [request params];
      if( [request params] != nil && [params objectForKey:@"result"] != nil ) {
        void(^completeBlock)(id result,NSError* error) = [params objectForKey:@"result"];
        completeBlock(result, nil);
      }
    }
    
    
    - (void)request:(FBRequest *)request didLoad:(id)result {
      [self processRequest:request withResult:result andError:nil];
    }
    
    
    - (void)request:(FBRequest *)request didFailWithError:(NSError *)error {
      [self processRequest:request withResult:nil andError:error];
    }
    

    I wish there was a better way to deal with the block but that’s the best one I have found so far. Is this the best way to do it? Probably not but that’s what I currently use and it seems to be ok, keeping all the FB interaction away from my View Controllers.

    Note all the code here assumes ARC that’s why there are no releases

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

Sidebar

Related Questions

Just wondering what the best practice is in HTML. I have noticed that I
I'm wondering, are there any guidelines or best practices on when to use sessions
I am wondering what the best practice is in iOS development when it comes
I am wondering what is best practice for using IP addresses in publicly available
I am wondering what would be the the best practice for refactoring code that
I was wondering what the best practice is when using PHP within HTML? Would
I am wondering what people have found their best practice to be for testing
I'm wondering about a best practice using NHibernate, AutoMapper and ASP.NET MVC. Currently, i'm
I wondering what the best practice way (in C#) is to implement this xpath
I'm wondering what the best practice is for handling the problem with having to

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.