Jackson Tale
Jackson Tale

Reputation: 25812

iphone - how to know the storage size an app used?

My app is caching content so that user can read it when offline.

I wrote everything of the cache into a database file (using CoreData) in iPhone.

However, the storage size is limited in iphone. So I would like to control the disk size my app is using.

How can I check the disk size I am using?

thanks

Upvotes: 3

Views: 355

Answers (1)

TechZen
TechZen

Reputation: 64428

The simplest and most accurate solution is to check the size of the persistent store directly.

Use -[NSFileManager attributesOfItemAtPath:error:] and then the fileSize key of the returned dictionary.

Upvotes: 2

Related Questions