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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:34:41+00:00 2026-05-25T23:34:41+00:00

i have implemented this sample code below to get a connection to the user

  • 0

i have implemented this sample code below to get a connection to the user feed post

- (void)viewDidLoad
{
    [super viewDidLoad];

    facebook = [[Facebook alloc] initWithAppId:@"197765190297119" andDelegate:self];
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
    facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];


}

and this sample code is called when the user logs in… it calls now by a button pressed for check, but dosent do any, perhaps i can get a dialog feed insted

    NSString *str=@"Your String to post";

NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                               str,@"message",
                               @"Test it!",@"name",                                   
                               nil];
Facebook *fb = [[Facebook alloc] init];
[fb requestWithGraphPath:@"me/feed"   // or use page ID instead of 'me'
               andParams:params
           andHttpMethod:@"POST"
             andDelegate:self];
  • 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-25T23:34:42+00:00Added an answer on May 25, 2026 at 11:34 pm

    This is a walkthrough of uploading an image to the facebook wall. I copied this out of an older application, the current facebook API works a little bit different. I think you can see my main point of using a shared facebook object, which you use to do the authentication and also the requests to the API. I took out a few things to make it easier to understand. Apple actually wants you to check for an existing internet connection. I hope it helps.

    @synthesize facebook;
    
    //login with facebook
    - (IBAction) facebookButtonPressed {
        if (!facebook || ![facebook isSessionValid]) {
            self.facebook = [[[Facebook alloc] init] autorelease];
            NSArray *perms = [NSArray arrayWithObjects: @"read_stream", @"create_note", nil];
            [facebook authorize:FACEBOOK_API_KEY permissions:perms delegate:self];
        }
        else {
            [self fbDidLogin];
        }
    }
    
    //upload image once you're logged in
    -(void) fbDidLogin {
        [self fbUploadImage];
    }
    
    - (void) fbUploadImage
    {
        NSMutableDictionary * params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                        resultImage, @"picture",
                                        nil];
        [facebook requestWithMethodName: @"photos.upload" 
                              andParams: params
                          andHttpMethod: @"POST" 
                            andDelegate: self]; 
    
        self.currentAlertView = [[[UIAlertView alloc]
                                 initWithTitle:NSLocalizedString(@"Facebook", @"")  
                                 message:NSLocalizedString(@"Uploading to Facebook.", @"")  
                                 delegate:self 
                                 cancelButtonTitle:nil
                                 otherButtonTitles: nil] autorelease];
    
        [self.currentAlertView show];
    }
    
    //facebook error
    - (void)request:(FBRequest*)request didFailWithError:(NSError*)error
    {
    
        [self.currentAlertView dismissWithClickedButtonIndex:0 animated:YES];
        self.currentAlertView = nil;
    
        UIAlertView *myAlert = [[UIAlertView alloc]
                                initWithTitle:NSLocalizedString(@"Error", @"")  
                                message:NSLocalizedString(@"Facebook error message", @"")
                                delegate:self 
                                cancelButtonTitle:nil
                                otherButtonTitles:@"OK", nil];
        [myAlert show];
        [myAlert release];
    }
    
    //facebook success
    - (void)request:(FBRequest*)request didLoad:(id)result
    {
        [self.currentAlertView dismissWithClickedButtonIndex:0 animated:YES];
        self.currentAlertView = nil;
    
        UIAlertView *myAlert = [[UIAlertView alloc]
                                initWithTitle:NSLocalizedString(@"Facebook", @"") 
                                message:NSLocalizedString(@"Uploaded to Facebook message", @"")
                                delegate:self 
                                cancelButtonTitle:nil
                                otherButtonTitles:@"OK", nil];
        [myAlert show];
        [myAlert release];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implemented this code, but fail at compilation (VC2008 Express Ed.) : Now
I haven't yet implemented this, I'm still in the thinking stage, but I have
This is regarding AES algorithm. Suppose i have implemented a AES algorithm and encrypt
I was wondering how other people implemented this scenario. I have an internal rails
I just finished reading this post: https://developer.yahoo.com/performance/rules.html#flush and have already implemented a flush after
I have followed this article and implemented my service and I can open the
I have a web service implemented in WCF. This service is only going to
I have a web service, defined(WSDL) and implemented in PHP. This one is relatively
I have an app that includes a search feature. This feature is implemented by
Basically i have a container which implements IEquatable (sample shown below) public class ContainerClass

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.