Pngs being purge when app goes in background - iphone

I am using AFNetworking to save image from a Url, it uses NSCache to cache the images from the requested urls. When app goes in background and phone is locked, png's are being purged but jpegs are not.I read there is some auto expiration policy in NSCache.
Please help me solve this weird issue.

Related

Flutter Menu App that gets pictures from firebase

I have a flutter app that is a menu for a restaurant. Now the problem is that I want to get the pictures from firebase. Currently, if you open the app, the pictures take time to load and you can see that with your eyes, it is a bit annoying and not practical regarding bandwidth data usage.
Is there any chance I can cache the images when I get them from firebase and than appear instantly? I request the links of the images once the page is open using a future and display them with a CachedNetworkImageProvider() with the image URL but that still takes time to load the images. Is there a way to download all the data in the firebase at once when you open the app and not check every time you open the app?
for all apps that require fetching images from a remote location, what i have been doing so far is download the image locally and use the local image instead of the remote one if it exists locally, from my knowledge cachedNetworkImage only caches the image after fetching when the app is currently running and refetches the image when the user restarts the app.
Please if you do find another way to cache images that would be cool and remove a lot of boiler plate code, please do post it, thanks.

How to save a large (60mb+) image to photo library?

I know the various ways to save a UIImage to the photo library:
UIImageWriteToSavedPhotosAlbum
ALAssetsLibrary
However, my images are HUGE (60mb+), so bringing them into memory is not possible. I can download the images by streaming them to disk, and even use imageWithContentsOfFile to take a peek (although that is kind of unnecessary given screen size).
But I want the user to be able to save these images for later. Is there anyway for me to get these large images into the photo library? Do I just have to keep them stored locally inside the app sandbox?
I believe that there is no point at storing them at the photo library, since it is designed to be viewed on the device and theres no point at viewing an image so big. If you want to let the user see the image then i suggest you create a preview and save THAT version into the photo library. If you want to let the user transfer them from the device to the computer there is a special folder in your app bundle which will allow those pictures to appear when using itunes and selecting your application. then he can transfer those pictures to his computer. Also could you elaborate on the characteristics of the images? format, dimentions, purpose, etc.

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!

Having to store too many image files

So I have a huge app. It is full of features, most of which require a couple images, and all of which have to be saved as part of the binary file. I worked really hard before the release to get under the 20MB threshold, to make the app more accessible to users. My release binaryt was 18.1MB.
So now, with the new iPad and its retina display, what should I do about updating all of my images for this new display. If I did include an updated copy, I would be way over the 20MB limit. Currently, I store some image files on my sever, and download/cache them as the user needs them, but im hesitant to do this with major features because I'm concerned some users may not always have internet access. And without some of those images, the app is useless.
Is there any way I can have an iPhone only install the iPhone graphics, and visa versa?
Apple has since raised the limit for all devices to 50 MB due to the release of the new iPad. This should hopefully allow you to fit all of the pictures in your app bundle.
One approach to minimize the size of your files is by compressing your PNG files. This will only minimize the size, and the images will continue to work correctly.
The links provided below will help you find a crusher you desire.
PNG Crush
PNG Compressor
ImageOptim

iPhone App to generate thumbnail images for the image obtained via camera or photo gallery

My app allows user to obtain picture/image from camera/photo gallery and then the app will upload the images to remote storage. Since the thumbnail images of those images will be used in some scenarios, I need to generate the thumbnail images.
The questions are
should the thumbnail images be generated by the app at the time when the original/raw image is obtained?
is it achievable to upload a raw image and at least 2 of its thumbnail images at the same time from the app to the remote storage - let's say its Amazon S3 or Google App Engine
is there any sample code out there that does the image transformation on iPhone?
I think you should, and put a progress indicator on top to tell your user that "please wait, I'm generating thumbnails".
I don't think at the same time is appropriate for you. Instead, you should try to upload them (2 thumbnails and 1 raw) in a serial manner. That is, "try 1st thumbnail, if succeed, try 2nd thumbnail...",since the internet connection for a mobile device like iPhone could be unstable. Requests-timing-out does happen, therefore it's better to always make sure you have finished the previous request before you start the next one.
I think three20's TTThumbsViewController (or TTPhotoViewController) has done a good job in transforming original photos into square-shaped thumbnails. Maybe you should take a look at their source code.
btw, as for uploading photos to servers, I once used the ASIFormDataRequest to post my photos to a server. It worked pretty well.
Hope it helps. :-)