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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:02:50+00:00 2026-06-13T13:02:50+00:00

I found on some forum post about saving image from web site to iphone

  • 0

I found on some forum post about saving image from web site to iphone app and I’m using it because everything is ok with it except one thing, speed.

Image is about 10KB and it’s downloaded with ok speed when there is one image, but when there are 15-20 images it’s very slow.

I know there must be way to download image faster on another way becase I have some news apps on my iPhone and this apps download 15-20 articles with images like my (I say like my because quality is the same or better) and is about 5 seconds faster (or more).

So my question is; Is there another faster way to download images from website to iPhone app?

This is my code:

#define kBgQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) //1

#import "downloadImage.h"

@interface downloadImage ()

@end

@implementation downloadImage

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}



- (void)viewDidLoad
{
    [super viewDidLoad];

    NSString *imgUrl = @"http://somesite.com/someimage.jpg";

    dispatch_async(kBgQueue, ^{

        [self performSelectorOnMainThread:@selector(downloadImageFromWeb:) withObject:imgUrl waitUntilDone:YES];

    });

}

-(void)downloadImageFromWeb:(NSString *)imgUrl{


    UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:imgUrl]]];

    NSArray *parts = [imgUrl componentsSeparatedByString:@"/"];

    NSString *imgFilename = [parts lastObject];

    [self saveImage:image:imgFilename];

}


- (void)saveImage:(UIImage*)image:(NSString*)imageName {

    NSData *imageData = UIImageJPEGRepresentation(image, 100);
    NSFileManager *fileManager = [NSFileManager defaultManager];

    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];

    NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:
                          imageName];

    [fileManager createFileAtPath:fullPath contents:imageData attributes:nil];

    //NSLog(@"image saved");

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
  • 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-13T13:02:52+00:00Added an answer on June 13, 2026 at 1:02 pm

    1) check the actual load time for this image from a normal browser, this might be a server-side issue

    2) try to use some proven code for this, like AsyncImageView and see if there is any difference with yours.

    3) remove saving and test again. If it goes faster, subthread the saving (however, it is not good idea to create so many threads)

    4) why do you perform load selector on main thread ? Do it on background thread and later update the image on the main one. The way you are dispatching it now it blocks the main thread.

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

Sidebar

Related Questions

I did a google search and found some forum threads explaining it won't work
I want to submit a form without page refresh using jQuery. I found some
I found some really great code from Matt Gallagher for use with making Undo
I want to make a POST to a PHP site from a C# WinForm
I'm starting to do some web development and I was learning about forms and
I post here because I question myself about the structure of a future project.
I have found some code on measuring execution time here http://www.dreamincode.net/forums/index.php?showtopic=24685 However, it does
I found some lovely websites - http://www.mini.jp/event_campaign/big-point/ , http://www.twenty8twelve.com/ and http://www.scozzese.com - all vertical
I found some problems when implementing Jake Wharton 's ViewPagerIndicator . These are what
I found some things I want to submit a pull request for in the

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.