问题
I want to send the coreData sqlite file via mail
NSURL *appDoc = [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
NSURL *storeURL = [appDoc URLByAppendingPathComponent:@"Log.sqlite"];
NSData *sqliteData = [[NSData alloc] initWithContentsOfURL:storeURL];
MFMailComposeViewController * mailComposeVC = [[MFMailComposeViewController alloc] init];
[mailComposeVC addAttachmentData:sqliteData mimeType:@"application/x-sqlite3" fileName:@"Log.sqlite"];
All data exists in DB, I can see it by call executeFetchRequest
on NSManagedObjectContext
But, the file is empty.
I try to insert 10,000 rows for testing. and after that the file include 9775 rows only.
Why?
来源:https://stackoverflow.com/questions/26833013/sqlite-file-is-empty-when-send-it-via-mfmailcomposecontroller