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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T03:29:52+00:00 2026-05-31T03:29:52+00:00

I’m developing a iOs 5 app and I’ve implemented Facebook SDK for iOs. I

  • 0

I’m developing a iOs 5 app and I’ve implemented Facebook SDK for iOs. I would like to share a picture so that’s my code (isn’t working):

if (buttonIndex==3) {


    if (facebook == nil) 
    {
        // Setup Facebook connection
        [self setUpFacebookConnection];
    }else {
        [self fbDidLogin];
    }          
}   

 }
- (void)setUpFacebookConnection
{
facebook = [[Facebook alloc] initWithAppId:@"245697495524266" 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:
                            @"offline_access", @"publish_stream", @"publish_actions", @"photo_upload", nil];

    [facebook authorize:permissions];
}
 }

 - (void)fbDidLogin{ 

 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
 [defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"];
 [defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"];
 [defaults synchronize];


 bannerview2.hidden=YES;

 if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)])
    UIGraphicsBeginImageContextWithOptions(self.view.bounds.size, NO, [UIScreen mainScreen].scale);
 else
    UIGraphicsBeginImageContext(self.view.bounds.size);

// retrieve the current graphics context
 CGContextRef context = UIGraphicsGetCurrentContext();

// render view into context
[self.view.layer renderInContext:context];

// create image from context
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

// save image to photo album
UIImageWriteToSavedPhotosAlbum(image,
                               self,
                               nil,
                               @"image.png"); 
bannerview2.hidden=NO;


NSMutableString *message = [[NSMutableString alloc] init];
[NSString stringWithFormat:@"Resultado final %@: %d vs. %@: %d. Mi jugador hizo %d puntos y cometió %d faltas.",intnomlocal, puntsl, intnomvisitant, puntsv, puntsjugadorint, faltesjugadorint];




 NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:image,     @"picture", message,@"message", nil];

  [facebook requestWithGraphPath:@"me/feed"andParams:params andHttpMethod:@"POST" andDelegate:self];    

}

So it all works unless the part of sharing the picture in -(void) fbDidLogin. How can I fix it?

  • 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-31T03:29:53+00:00Added an answer on May 31, 2026 at 3:29 am

    You are missing the necessary permissions. As per https://developers.facebook.com/docs/reference/api/permissions/ you need the permission publish_stream. However, even with that permission, i’m not 100% sure that you’re allowed to post to me/photos. Try posting to the feed first!

    [edit] turns out I was wrong. To upload an UIImage, you need both the user_photos, publish_stream and upload_photos permission and post to me/photos – you can’t post to me/feed with an image to upload.

    The newer facebook api explorer, directly from fb, is a bit better. https://developers.facebook.com/tools/explorer

    You can check the documentation here under “Publishing” for what and where you can publish. Note that you can only upload photos to existing albums, for which you need the album-ID.

    You should implement the FBRequestDelegate protocol in your class to see what’s failing and how.

    [edit 2] check this post: other SO post – it seems you really need the publish_stream permission as well. Try it again, if you can’t get around it, I’ll setup a test environment.

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

Sidebar

Related Questions

I would like to count the length of a string with PHP. The string
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small

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.