ASIHttpRequest replacement and image caching - iphone

I've been using ASIHttpRequest library for a while for downloading images and storing them for cache. Since it is deprecated already I'm looking for a replacement library.
My needs are to download a new image and to store it for cache only and only if image has changed on server. Otherwise to use cached image.
Is there a good and lite alternative to beloved ASIHttpRequest?

Sure there is: AFNetworking
AFNetworking is de-facto the natural replacement of ASIHTTP. It's a lovely library and version 2.0 has just being launched.
Another great library is surely SDWebImage, which provides a lot of useful functionalities for downloading and caching images.
You are clearly free to use both in your project. I personally use AFNetworking for any network operation a part from images, for which I use SDWebImage.

If you're just looking for a library to handle image downloads and caching, I recommend SDWebImage.
It includes a category class on UIImageView as well as SDWebImageManager if you're just looking to download images and not immediately place them in a UIImageView.

This link would help you it will download it and next time it will take images from cache

Related

Does Kingfisher support video caching?

I've scoured both the Kingfisher docs and Stack Overflow, and there is no clear answer to whether Kingfisher supports video caching. I'm new to caching videos/images in general, so if someone could expand on (1) whether caching videos with Kingfisher is possible? and (2) the difference between caching videos and images?
And if Kingfisher does not support video caching, a recommendation for tackling video caching would be appreciated. I'm using Firebase Storage for my videos, fyi.
As mentioned in Kingfisher's GitHub site:
Kingfisher is a lightweight, pure-Swift library for downloading and
caching images from the web. This project is heavily inspired by the
popular SDWebImage. It provides you a chance to use a pure-Swift
alternative in your next app.
Kingfisher is used for image downloading and caching only. If you want to cache video, Kingfisher can't help. By caching if you mean to store the video somewhere so that next time the user won't need to download again, simpliy store the video's in document folder.

How to multiple background video downloads in iOS?

I have an iOS application, where I need to download over 60-70 videos a week of size 3-8MB each.
The issue is, how do I download these videos?
I am storing the list of videos and urls in a database.
Possible solutions:
Use a UIBackgroundTaskIdentifier, call beginBackgroundTaskWithExpirationHandler as soon as the app starts. This task will download one video.
In the endBackgroundTask I will mark that particular video as downloaded.
Concerns here are, can I start multiple UIBackgroundTaskIdentifier?
Where should I start them? In AppDelegate? A particular controller?
If I start it in a particular controller, on viewDidLoad() what will happen if the app exits?
Please guide me or provide an alternate solution.
Thanks
Use AFNetworking as ASIHTTPRequest is deprecated.
Refer AFNetworking source link.
Also refer afnetworking-downloading-multiple-files link and Does AFNetworking have backgrounding support link.
EDIT : start downloading in AppDelegate
Check AFDownloadRequestOperation for resumable download.
Refer afnetworking-pause-resume-downloading-big-files using AFDownloadRequestOperation link.
You can download multiple files with ASIHTTPRequest in the background. See the documentation here.
Please note that ASIHTTPRequest is no longer working so you can use AFNetworking.
AFNetworking is a delightful networking library for iOS and Mac OS . It's built on top ofNSURLConnection,NSOperation, and other familiarFoundation technologies`. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use.
Find the SDK here.

The most efficient method updating images

I am just after some advice re the most efficient method of adding new images to my App.
I need to store 80+ new 300 x 100 pixel images to my app every couple of weeks.
I am worried it will take to long to download these images in the background.
What is the most efficient method of updating and storing this image data?
Is the most efficient method simply releasing an update of the app to itunes?
you may use SDWebImage , and you don't have to worry about cache and etc
Web Image
This library provides a category for UIImageVIew with support for remote images coming from the web.
It provides:
An UIImageView category adding web image and cache management to the Cocoa Touch framework
An asynchronous image downloader
An asynchronous memory + disk image caching with automatic cache expiration handling
A guarantee that the same URL won't be downloaded several times
A guarantee that bogus URLs won't be retried again and again
Performances!

iPhone: Efficiently downloading images from a URL into iPhone App

In my iPhone app , I need to display the images from server.
I need to download it and save it from URLs.
There are roughly 20 images which I need to download.
What could be a way out where in performance doesnt decrease?
I have tried previously using NSData to convert the images into NSData and saving it to my app but it takes lots of time.
What could be a more easier and efficient way out?
I recommend using ASIHTTPRequest to download the images asynchronously, and display them when they're ready. By using the asynchronous interface of that class, your app can be responsive and continue to operate normally while, in the background, you wait for the data to be loaded.
ASIHTTPRequest is open source and free to use: http://allseeing-i.com/ASIHTTPRequest/
The code the Facebook app uses to download and display images has been open-sourced as part of the three20 library.
If you want to write your own networking code ASIHTTPRequest is a very useful library that includes features such as downloading directly to a file and queue management.

Downloading Images on iPhone - How does Facebook do it?

How does the Facebook app go about downloading/displaying the images in photo galleries? They appear to load in at varying times which would indicate some degree of threading? Surely the app doesn't spawn X amount of threads (where X is the number of pictures) as this would cause performance issues? Can anyone enlighten me as I would like to use something similar in my app (I will be regularly downloading a large amount of photos and displaying them in the app so downloading them one after another takes too long). Also, these photos change on a fairly regular basis so downloading once and cacheing isn't really an option.
Is there some kind of framework/solution around that might help me achieve something similar to Facebooks galleries?
Thanks,
Jack
The code the Facebook app uses to do this has been open-sourced as the three20 library. This functionality is provided in TTPhotoViewController.
Have a look at the LazyTableImages example from Apple. The images are downloaded asynchronously and have a reference back to where they are supposed to be displayed.
I would recommend you use this Library, ASIHTTPRequest, which is like an extended version of the NSURLRequest. I have been using it to download images for later display, asynchronously. It has a nice CACHE implementation which saves bandwidth and loading times on your app.