I think you should use:
application / x-sqlite3 instead of application / sqlite for mimeType
EDIT: this solved it and sent the file:
-(IBAction)mandar:(id)sender { MFMailComposeViewController *composer=[[MFMailComposeViewController alloc]init]; [composer setMailComposeDelegate:self]; if ([MFMailComposeViewController canSendMail]) { [composer setToRecipients:[NSArray arrayWithObjects:@"EMAIL Address here",nil]]; [composer setSubject:@"Base de datos"]; [composer setMessageBody:@"Mensage" isHTML:YES]; [composer setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
Commented this out from your code:
// NSArray * paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES);
// NSString * documentsDirectory = [paths objectAtIndex: 0];
// NSString * file = [documentsDirectory stringByAppendingPathComponent: @ "capturas.sqlite"];
// NSData * data = [NSData dataWithContentsOfFile: file];
And replace the following
NSString *path = [[NSBundle mainBundle] pathForResource:@"database name without extension" ofType:@"sqlite"]; NSData *myData = [NSData dataWithContentsOfFile:path]; [composer addAttachmentData:myData mimeType:@"application/x-sqlite3" fileName:path]; [self presentModalViewController:composer animated:YES]; } else { UIAlertView *alert=[[UIAlertView alloc] initWithTitle:@"Error" message:@"No se a podido mandar el mensage" delegate:self cancelButtonTitle:@"dismis" otherButtonTitles:nil, nil]; [alert show]; }
}
source share