magicalpanda / MagicalRecord

Super Awesome Easy Fetching for Core Data!
Other
10.8k stars 1.79k forks source link

Apple Storage Guidelines using MagicalRecord. #1226

Open itsprabin opened 8 years ago

itsprabin commented 8 years ago

0 down vote favorite I am working on a social media project. I have used CoreData with Magical Record to store chat messages, friend list. As per my understanding Magical Record stores data in /Library/Application Support directory. The content of this directory is backed up if we use iCloud backup.

As per iOS Storage Guidelines, user created data are to be stored in /Document folder. When I start chat conversation or add friend I save it in core data, this means user created data is being stored in /Library/Application Support directory. Is this Ok with storage guidelines?

Do I have to store these in /Document directory. Also my friend list, chat messages will be maintained in the server, so I can sync my app database with that of server. These are downloadable content and apple says not to save downloadable content in the /Document directory. So what is the correct way? Does Magical Record handles all these cases?

seyi commented 8 years ago

Hi, You can prevent icloud backup for a directory path by using the setxttr() function to add attribute that makes icloud not backup your data in the path..like so

int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);

you can check the SO link below for details http://stackoverflow.com/questions/8694112/adding-the-do-not-backup-attribute-to-a-folder-hierarchy-in-ios-5-0-1