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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:02:23+00:00 2026-06-18T00:02:23+00:00

I am currently using only Social.framework (no FacebookSDK) and getting starting with requesting and

  • 0

I am currently using only Social.framework (no FacebookSDK) and getting starting with requesting and getting access to basic user data. Here’s all the code I have (with a few properties declared outside, as you’ll notice). Everything works fine in terms of getting the right permissions, but I’m getting the following output error when asking for user’s profile picture:

2013-01-27 21:28:44.324 TestApp[9230:1a703] Account saved to accountStore
2013-01-27 21:28:45.002 TestApp[9230:1d603] (null)
2013-01-27 21:28:45.003 TestApp[9230:1d603] Request error: The operation couldn’t be     completed. (Cocoa error 3840.)

And here is the code:

- (IBAction)btnFbLoginPressed:(id)sender
{
ACAccountType *fbAccountType = [self.accountStore accountTypeWithAccountTypeIdentifier: ACAccountTypeIdentifierFacebook];
NSArray *permissions = @[@"email"];
self.requestAccessOptions = @{ACFacebookAppIdKey:FB_API_KEY, ACFacebookPermissionsKey:permissions, ACFacebookAudienceKey:ACFacebookAudienceOnlyMe};

[self.accountStore requestAccessToAccountsWithType:fbAccountType options:self.requestAccessOptions completion:^(BOOL granted, NSError *e) {
    if (granted && e == nil) {

        NSArray *readPermissions = @[@"user_photos"];
        NSDictionary *readAcccessOptions = @{ACFacebookAppIdKey:FB_API_KEY, ACFacebookPermissionsKey:readPermissions, ACFacebookAudienceKey:ACFacebookAudienceOnlyMe};

        [self.accountStore requestAccessToAccountsWithType:fbAccountType options:readAcccessOptions completion:^(BOOL granted, NSError *e) {
            if (granted && e == nil) {

                NSArray *accounts = [self.accountStore accountsWithAccountType:fbAccountType];
                self.facebookAccount = [accounts lastObject];

                [self.accountStore saveAccount:self.facebookAccount withCompletionHandler:^(BOOL success, NSError *error) {
                    if (error != nil || !success) {
                        NSLog(@"Error saving account to accountStore: %@", error.localizedDescription);
                    } else {
                        NSLog(@"Account saved to accountStore");
                    }
                }];

                NSString *uid = [NSString stringWithFormat:@"%@", [[self.facebookAccount valueForKey:@"properties"] valueForKey:@"uid"]];
                NSString *url = [NSString stringWithFormat:@"https://graph.facebook.com/%@/picture", uid];
                NSURL *profilePictureURL = [NSURL URLWithString:url];

                SLRequest *profilePictureRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:profilePictureURL parameters:nil];
                profilePictureRequest.account = self.facebookAccount;

                [profilePictureRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *e)
                 {
                     NSDictionary *responseDataDictionary = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&e];
                     NSLog(@"%@", responseDataDictionary);
                     if (e != nil) {
                         NSLog(@"Request error: %@", e.localizedDescription);
                     } else {

                     }
                 }];

            } else {
                NSLog(@"Read permissions request error: %@", e.localizedDescription);
            }
        }];

    } else {
        NSLog(@"Basic permissions request error: %@", e.localizedDescription);
    }
}];
}

You can see that the reponseDataDictionary is null and something happens when parsing the data. I noticed a couple of other threads on SO about the same error code, but no luck so far. My guess is that either 1) there’s something wrong with my Facebook code, or 2) I’m parsing the data incorrectly. Any help’s appreciated!

Note: I would like to stick to using the Social/Account frameworks only.

UPDATE: Slight modification thanks to a suggestion in the comments.

Changed code:

[profilePictureRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *e)
{
   NSLog(@"Request error value: %@", e.localizedDescription);

   NSError *jsonError = nil;
   NSDictionary *responseDataDictionary = [NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingAllowFragments error:&jsonError];
   NSLog(@"Response data dictionary value: %@", responseDataDictionary);
   if (jsonError != nil) {
       NSLog(@"Serialization error: %@", jsonError.localizedDescription);
   } else {
       NSLog(@"Serialization successful");
   }
}];

Output:

2013-01-28 18:55:16.265 TestApp[9565:1ae03] Account saved to accountStore
2013-01-28 18:55:17.640 TestApp[9565:1b503] Request error value: (null)
2013-01-28 18:55:17.640 TestApp[9565:1b503] Response data dictionary value: (null)
2013-01-28 18:55:17.642 TestApp[9565:1b503] Serialization error: The operation couldn’t be completed. (Cocoa error 3840.)
  • 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-18T00:02:24+00:00Added an answer on June 18, 2026 at 12:02 am

    The profilePictureRequest is returning an image and not JSON. Use + (CIImage *)imageWithData:(NSData *)data to convert the response to an image.

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

Sidebar

Related Questions

I am currently using code similar to this: try { // IE ONLY var
I am currently using $.blur(fn();) for form validation, but this only takes effect when
I have a PHP based web application which is currently only using one webserver
I'm currently trying to design the database for a simple social site. I'm using
I'm currently maintaining a small-medium sized java web application (using only plain JSPs/Servlets) that
Im currently using jquery to link all td's to the edit link but i
We are creating a website, and we are currently only using HTML5 and javascript.
currently thinking on a possibility to sniff at the same interface using only pcap
I'm currently using FireBug, and it is absolutely amazing. The only problem is that
I want to load the content of head using curl only ,currently iam using

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.