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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:17:09+00:00 2026-06-12T05:17:09+00:00

I have to download an image from the server but I do not wish

  • 0

I have to download an image from the server but I do not wish to create NSURLConnection, I know that UIKit is not thread safe so I tried this, just need a confirmation whether if this is safe or can it result in a crash (as of now it is working fine.)I tried the following

Look at the case 2 of the switch.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
  switch (indexPath.row) {
    case 0:
    {
      CreateNewSurveyViewController *vc=[[CreateNewSurveyViewController alloc] init];
      [self.navigationController pushViewController:vc animated:YES];
      [vc release];
      break;
    }
    case 1:{
      MySurveyViewController *mySurveyViewController=[[MySurveyViewController alloc] init];
      [self.navigationController pushViewController:mySurveyViewController animated:YES];
      [mySurveyViewController release];
      break;
    }
    case 2:{

        self.progressHud.hidden = NO;
        [self performSelectorInBackground:@selector(loadProfileImage) withObject:nil];
      break;
    }
    default:
      break;
  }
}   
-(void)loadProfileImage {

    NSData* profileImageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:self.userAccount.profileImageURL]];
    [self performSelectorOnMainThread:@selector(launchSettingsView:) withObject:profileImageData waitUntilDone:YES];

}

-(void)launchSettingsView:(NSData*)profileImageData {
    self.userAccount.userImage = [UIImage imageWithData:profileImageData];
    self.progressHud.hidden = YES;
    SettingsViewController* settingsViewController=[[SettingsViewController alloc] init];
    settingsViewController.userAccount = self.userAccount;
    settingsViewController.delegate = self;
    [self.navigationController pushViewController:settingsViewController animated:YES];
    [settingsViewController release];
}
  • 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-12T05:17:10+00:00Added an answer on June 12, 2026 at 5:17 am

    This looks safe to me. You do all your networking on a background thread, and then only touch the UI in the main thread method you call back to. Usually people will use GCD or NSOperationQueue but this should work too.

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

Sidebar

Related Questions

I have a script that download's files from a server, all works nice. But
I have some code that downloads an image from a remote server $data =
I want to Download An image from a remote server. But each time I
I have written a code to download pdf file from server, but the code
I have a desktop application that needs to upload/download images to/from service computer over
I have a thread that downloads some images from internet using different proxies. Sometimes
I have image on server of dimension 1000x800. I download it using following approaches:
how to download a image from a web server to java SE application. i
i want to display a image after downloading that image from a web-server i
I want to download a file from server to a local host. i have

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.