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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:23:57+00:00 2026-06-15T21:23:57+00:00

My app has to download profile pictures from facebook. The code that I wrote

  • 0

My app has to download profile pictures from facebook. The code that I wrote to download images works well with image url that has direct links (e.g.: http://www.mydomain.com/profile_picture.png)

But it produces an error for facebook urls (e.g.: http://graph.facebook.com/100000741043402/picture)

Following is the code:

NSURLRequest *imageRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:imageUrl] cachePolicy:NSURLRequestReturnCacheDataDontLoad timeoutInterval:30.0];
    AFImageRequestOperation *operation = [AFImageRequestOperation imageRequestOperationWithRequest:imageRequest
                                                                              imageProcessingBlock:nil
                                                                                         cacheName:@"nscache"
                                                                                           success:^(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image){                                                                                                                                                                                                   profilePicture.image = image;

                                                                                               [profilePicture.layer setBorderColor: [[UIColor colorWithRed:137.0/255.0 green:137.0/255.0 blue:137.0/255.0 alpha:1.0] CGColor]];
                                                                                               [profilePicture.layer setBorderWidth: 2.0];
                                                                                           }
                                                                                           failure:^(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error){ NSLog(@"%@",[error description]); }
                                          ];
    [operation start];

And following is the response:

Error Domain=NSURLErrorDomain Code=-1008 "resource unavailable" UserInfo=0x97e0ae0 {NSErrorFailingURLStringKey=http://graph.facebook.com/100000741043402/picture, NSErrorFailingURLKey=http://graph.facebook.com/100000741043402/picture, NSLocalizedDescription=resource unavailable, NSUnderlyingError=0xa3559b0 "resource unavailable"}

Any tips/suggestions would be highly appreciated.

  • 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-15T21:23:59+00:00Added an answer on June 15, 2026 at 9:23 pm

    If you use curl to dump the headers of the entire HTTP conversation, you’ll see:

    $curl -IL http://graph.facebook.com/100000741043402/picture
    HTTP/1.1 302 Found
    Access-Control-Allow-Origin: *
    Cache-Control: private, no-cache, no-store, must-revalidate
    Content-Type: image/jpeg
    Expires: Sat, 01 Jan 2000 00:00:00 GMT
    Location: http://profile.ak.fbcdn.net/hprofile-ak-snc6/186199_100000741043402_1626005174_q.jpg
    Pragma: no-cache
    X-FB-Rev: 693801
    X-FB-Debug: dB4yzLkbQuq46xPMq51wruVSccPCm94U4tePFC/VKoc=
    Date: Thu, 13 Dec 2012 07:00:39 GMT
    Connection: keep-alive
    Content-Length: 0
    
    HTTP/1.1 200 OK
    Content-Type: image/jpeg
    Content-Length: 3055
    Last-Modified: Fri, 01 Jan 2010 00:00:00 GMT
    X-Backend: hs478.snc6
    X-BlockId: 186199
    X-Object-Type: PHOTO_PROFILE
    Access-Control-Allow-Origin: *
    Cache-Control: max-age=1209600
    Expires: Thu, 27 Dec 2012 07:00:40 GMT
    Date: Thu, 13 Dec 2012 07:00:40 GMT
    Connection: keep-alive
    

    So FB is redirecting you to the profile picture, but NSURLRequest doesn’t follow redirects by itself. This post (Handling redirects correctly with NSURLConnection) shows how you can handle this, with the main lesson being that you have to follow the redirects until you end up with the 200 response that will indicate the terminal URL.

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

Sidebar

Related Questions

I'm building an iPhone app that has to download an Excel (.xls) file from
i'm developing an app that has a jtable and user could start a download.
My app downloads content from a server and recently I've noticed the GUI has
My app has an options menu that is available in almost all Activities, which
I wrote an iPhone app that plays wma stream, using libmms and ffmpeg open
I have completed client side code by download sample from git for push notification
I'm developing an Android game that has to download some assets to the SD
I am planning to develop a pretty awesome new web app that has a
my heroku app has dev plan the app is useable and works and if
Hello community, I'm trying to debug that I didn't made. This app works online

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.