问题
I have developed a app that loads fully static content . I am storing data more than 4 mb of size. With out this content the app will not work. In my case where should i save the local database(documents folder or library folder).
My app got rejected since it was backed up for iCloud storage.
1) Where should i save the database? In Library folder or inside Documents folder?
2) Since apple rejected my app i believe that I should not backup the database for iCloud. Please correct me if i was wrong.
3) In my app i am also taking screen shot and saving in document directory to attach it in mail. Whether can i save the screen shot in document directory or should i save it the caches folder? Please update.
Please guide me the right way to implement DB .
Thanks
回答1:
Please use below code in your application before saving database to your document directory..
-(BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)URL
{
const char* filePath = [[URL path] fileSystemRepresentation];
const char* attrName = "com.apple.MobileBackup";
u_int8_t attrValue = 1;
int result = setxattr(filePath, attrName, &attrValue, sizeof(attrValue), 0, 0);
// NSLog(@"Attributs : %d and Path : %@",result,URL);
if (result != 0) {
NSLog(@"File Backup Attribute setting error");
}
return result == 0;
}
来源:https://stackoverflow.com/questions/16767861/where-to-save-the-local-db-created-for-iphone-app