Instagram iPhone App Cache Size

Recently, I tired to use my iPhone to take a picture of my new born son. Instead of capturing a priceless memory, I received an error saying “Your iPhone out of storage space” or something to that effect.

I check my data storage, I went to “settings” -> “general” ->”usage”, and found that Instagram was taking up 1.4 GB of storage space. 1.4 GB! That’s insane!

I believe that Instagram saves or “caches” every image that you view on your iPhone, so you only have to download the image once. This is great, but what’s the limit to this?

I can’t find any options on the phone, or in the app to clear the cached files or set a limit on the cache size.

The best workaround I found was to delete the app from the phone, then to re-install it. This is less then ideal, but it works.

You may need to restart your iPhone before the iPhone starts reporting the newly cleared space.

I believe that Apple should allow a way for iPhone users to manage application cache sizes, or require app developers to report cache sizes along with clean up tools for the end user.

I love Instagram, but what would happen if I continued to use the app (and cache images) for the next year? My 32 GB iPhone would have 10+ GB of Instagram images on it.

Follow me on instagram – “JoshHighland”

Don’t use NSLog anymore!

NSLog is a convenient way to output logging information from your iPhone app. NSLog is most commonly used by developers for debugging purposes. The problem with adding NSLog statements in your code is that you have to remove them or comment them out before you can submit your application to the app store. Apps that output data via NSLog will not be approved into the app store.

I would like to show you how I handle this delema. Start by opening the “_Prefix.pch” file.

next, add the following lines to the file

#define DEBUG_MODE

#ifdef DEBUG_MODE
#define DebugLog( s, ... ) NSLog( @"<%@:(%d)> %@", [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__] )
#else
#define DebugLog( s, ... )
#endif

In your code, replace “NSLog” with “DebugLog”. THATS IT!

DebugLog adds some new functionality to NSLog. It will now output the file name and line number of the Debug statement.

The best part of this is that its very easy to disable when its time to create a release build of your code. Simple comment out the “#define DEBUG_MODE” line im the “_Prefix.pch” file.