2
我已經成功地在應用程序中收到了在我的應用程序中工作的電子郵件,但是無法通過電子郵件發送附件。我正在嘗試通過電子郵件發送核心數據.sqlite文件。該電子郵件發送罰款,但當我收到它沒有附件。我試圖製作一份文件併發送電子郵件,但仍然不好。從iphone應用程序文檔文件夾中發送一個文件
NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentPath = [searchPaths objectAtIndex:0];
NSString *path = [[NSString alloc] initWithFormat:@"%@/data.sqlite",documentPath];
NSString *Newpath = [[NSString alloc] initWithFormat:@"%@/newData.sqlite",documentPath];
NSURL *theFileUrl = [NSURL URLWithString:Newpath];
[[NSFileManager defaultManager] copyItemAtPath:path toPath:Newpath error:nil];
NSData *data = [NSData dataWithContentsOfURL: theFileUrl];
NSLog(@"%@",documentPath);
NSLog(@"%@",path);
[controller setSubject:@"Backup"];
[controller addAttachmentData:data mimeType:@"application/x-sqlite3" fileName:@"data.sqlite"];
[controller setMessageBody:@"testing." isHTML:NO];
[self presentModalViewController:controller animated:YES];
[controller release];
感謝您的幫助
你最初把你的data.sqlite文件放在資源或直接文件(手動)的位置?.....請檢查文件中是否存在data.sqlite或不... – Ravin 2011-04-11 05:12:02
Set在您設置數據後查看是否確實設置了斷點。我將您的電子郵件附件代碼與我自己的工作代碼進行了比較,看起來正確 – Bemmu 2011-04-11 05:33:28