Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

TJ Rogers
TJ Rogers
8,758 Points

My app is absurdly large when installed on iPhone - over 200 MB's

Hi, I'm pretty knew to coding, so apologies if I missed something painfully obvious.

I've created a very basic app - it's pretty much just string of UITableView's that the user navigates through to retrieve data. There are 25 table view controllers attached to 7 navigation controllers, and an additional 7 view controllers. I have a few png's for cell icon's and background images, etc, but taken all together these png's are less than 5 MB's.

The raw data is stored as a txt file in JSON format, and the files all together are less than 3 MB's.

At one point I had 65 pdf's stored in the app, and many of these were very large - some were over 3 or 4 MB's. But I recently put these on the back end in parse.com and deleted them from the app entirely, so there are no more pdf's to take up memory.

Now, despite all this, when I load the app onto my iPhone, the app is taking up 234 MB's of memory, which is completely nuts and no different than when the 65 pdf's were still in the program.

I've searched all through the app's files and can't find anything that would account for this bloated size. I've checked and double checked that the pdf files have been removed, and there is no trace of them. I deleted the files themselves, not just the reference to them in X-Code. I've tried restarting the computer in case there was some sort of cache in X-Code that needed to be cleared. I've deleted and reinstalled the app on my phone numerous times, in case there were some residual files left from previous versions. No good. App is still over 200 MB's

Any thoughts on why my app would be over 200 MB's when installed on a device? Can anyone point me in the right direction as to where I might check to clear some space?

Thanks!

TJ Rogers
TJ Rogers
8,758 Points

Nevermind, answered my own question. Turns out my suspicion was right - it was a caching issue. Went to the following folders: Xcode > Preferences > Locations > Derived Data. Cleared the derived data folder. This contained every file that I had ever included in the app, and was including them with every build. Obviously I was a little nervous about deleting stuff, but it worked. Now the app is 14.5 MB's, down from 234 - much better!

But please let me know if I inadvertently screwed something up that I don't know about :)

1 Answer

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

Glad you figured it out. There's a Mac app called Unused to find all the unused images in an Xcode project.