在尝试发送带有简单KML附件的邮件(只需几个字节)时,我会在发送过程中在控制台中收到以下警告。这些可以被忽略还是我犯了错误?邮件似乎发送好了
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error {
// Dismiss the e-mail controller once the user is done
[self dismissModalViewControllerAnimated:YES];
}
- (void) emailLocation: (CLLocation*) loc {
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"imhere" ofType:@"txt"];
NSString * kml=nil ;
NSString * finalkml=nil;
NSData * filedata=nil;
NSString * mime= @"application/vnd.google-earth.kml+xml";
if (filePath) kml = [NSString stringWithContentsOfFile:filePath];
if (kml) finalkml = [NSString stringWithFormat:kml,loc.coordinate.longitude, loc.coordinate.latitude,loc.altitude];
if (finalkml) filedata = [finalkml dataUsingEncoding:NSUTF8StringEncoding];
if (([MFMailComposeViewController canSendMail]) && (filedata))
{
MFMailComposeViewController *mcvc = [[[MFMailComposeViewController alloc] init] autorelease];
mcvc.mailComposeDelegate = self;
[mcvc setSubject:@"I'm here"];
NSString *body = [NSString stringWithFormat:@"at %f %f",loc.coordinate.latitude,loc.coordinate.longitude];
[mcvc setMessageBody:body isHTML:YES];
[mcvc addAttachmentData:filedata mimeType:mime fileName:@"imhere.kml"];
[self presentModalViewController:mcvc animated:YES];
}
else {
UIAlertView * av = [[UIAlertView alloc] initWithTitle:@"No Email" message:@"Unable to send email." delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[av show];
[av release];
}
}
我已从上面的电子邮件正文中删除了HTML,因为它弄乱了SO格式,但它是一个基本的HTML电子邮件,其中包含指向Google地图的链接。
控制台中报告的警告是
2010-02-21 14:23:38.809 DataTap[2008:850f] DA|Could not open the lock file at /tmp/DAAccountsLoading.lock. We'll load the accounts anyway, but bad things may happen 2010-02-21 14:23:41.420 DataTap[2008:207] DA|Pipe to DADaemon was lost. Search query 2147483647 is returning an error [Switching to thread 13827] 2010-02-21 14:23:44.197 DataTap[2008:207] DA|Pipe to DADaemon was lost. Search query 2147483647 is returning an error 2010-02-21 14:23:45.357 DataTap[2008:207] DA|Pipe to DADaemon was lost. Search query 2147483647 is returning an error 2010-02-21 14:23:45.855 DataTap[2008:207] DA|Pipe to DADaemon was lost. Search query 2147483647 is returning an error 2010-02-21 14:23:48.543 DataTap[2008:207] DA|Pipe to DADaemon was lost. Search query 2147483647 is returning an error 2010-02-21 14:23:48.848 DataTap[2008:207] DA|Pipe to DADaemon was lost. Search query 2147483647 is returning an error
“糟糕的事情可能发生” - 苹果人类程序员的愚蠢证据!
我见过这个问题email with audio报告了我的一个错误。因此,我尝试将我的附件的mime类型更改为text / xml,这没有任何区别,并且完全删除附件,此时错误发生了。
那么 - 这可能导致崩溃,还是安全?
答案 0 :(得分:1)
之前我看过“无法打开锁定文件”的消息,看起来是良性的。我不知道“管道到DADaemon”的消息,可能与邮件无关。
答案 1 :(得分:1)
我收到了这个警告“DA |无法在/tmp/DAAccountsLoading.lock打开锁定文件。无论如何我们都会加载帐户,但是我的MFMailComposeViewController中可能会发生坏事”,因为我有
[mailViewController addAttachmentData:imageData mimeType:@“image / png”fileName:@“”];
我只是设置名称和扩展名。现在一切正常工作=)
[mailViewController addAttachmentData:imageData mimeType:@“image / png”fileName:@“myfile.png”];
答案 2 :(得分:0)
我刚开始收到这些相同的消息。已经在设备iPhone OS 3.1.3上进行了调试,没有类似的问题。
很明显,当我输入发件人的电子邮件地址时,会弹出每个警告;对于TO:或CC:我没有尝试过BCC:字段。我之前从未见过这个调试器消息,我刚刚将可更新性类添加到app。一切都工作正常,以确定可达性,我没有在应用程序的MFMailComposer部分更改任何内容,我在先前的viewcontroller上推出MFMailComposer之前插入了Reachability实例。
我正在为我要输入的电子邮件地址的每个字母获取相同的DA |管道DADaemon行,当我找到我要查找的电子邮件时,它会停止打印到控制台并单击以从列表中添加它。无论哪种方式,我都不喜欢得到这个警告,不可能是件好事。我关闭了我的附件,但它没有删除警告。我正在导出为html文本,不确定它是否与它有关。我的didFinishWithResult MFMailComposer委托方法中没有任何额外内容。我只是为每个案例都有一条消息,通过alertView返回给用户,告知他们的电子邮件发生了什么。
寻找解决方案!!!
答案 3 :(得分:0)
试试这个
NSArray *paths = NSSearchPathForDirectoriesInDomains( NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"mytrack.kml"];
NSData *myData = [NSData dataWithContentsOfFile:path];
[picker addAttachmentData:myData mimeType:@"text/xml" fileName:@"mytrack.kml"];
答案 4 :(得分:0)
我是卡洛斯·马约拉尔的第二个回答。在我的情况下,我收到此错误,因为我将mimeType设置为@“application / pdf”。事实证明,pdf附件mimeType需要是@“pdf”而不是@“application / pdf”。一旦我将其更改为“pdf”,错误就消失了。