私はクライアント用の iPad アプリを持っていますが、アプリに機能を追加して、ボタンをクリックして電子メール プログラムを起動し、問題の診断のためにアプリで使用される sqlite データベースを送信できるようにする必要があります。アップルのサンプルアプリに従ったところ、うまくいきました。dbファイルが添付されたメールが送信されました。電子メールからファイルをダウンロードして SQLite Manager (Firefox) で開いた後、すべてのテーブル スキーマは正しいですが、データはありません。誰が問題が何であるか知っていますか?ダウンロードした db ファイルのサイズは、デバイスからのものとまったく同じです。ありがとう。
Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
if (mailClass != nil)
{
// check whether the current device is configured for sending emails
if ([mailClass canSendMail])
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"database file from ios app"];
// Set up recipients
NSArray *toRecipients = [NSArray arrayWithObject:@"someEmailAddress@gmail.com"];
[picker setToRecipients:toRecipients];
// Attach db file to the email
NSString *path = [[NSBundle mainBundle] pathForResource:@"MyDB" ofType:@"sqlite"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"application/x-sqlite3" fileName:@"MyDB.sqlite"];
// Fill out the email body text
NSString *emailBody = @"test email with db";
[picker setMessageBody:emailBody isHTML:NO];
picker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentModalViewController:picker animated:YES];
[picker release];
}
else // email not configured
{
// Alert email is not configured
}
}
else // older iOS
{
// Alert OS is too old
}