我的应用程序在关闭MFMailComposeViewController后不久就崩溃了。一个UIWebDocumentView正在发布,它释放了一个ComposeBodyField对象,并在objc_msgSend上崩溃。它只发生在一些时间,并且只发生在旧设备上。我假设有些东西在应该发布之前正在释放/清除,所以当发送消息时,该对象不存在。退出邮件编辑器后应用程序崩溃
问题是我再也找不到任何信息了,我不知道它是如何联系在一起的。如果任何人都能对此发光,那就太好了。
我的应用程序在关闭MFMailComposeViewController后不久就崩溃了。一个UIWebDocumentView正在发布,它释放了一个ComposeBodyField对象,并在objc_msgSend上崩溃。它只发生在一些时间,并且只发生在旧设备上。我假设有些东西在应该发布之前正在释放/清除,所以当发送消息时,该对象不存在。退出邮件编辑器后应用程序崩溃
问题是我再也找不到任何信息了,我不知道它是如何联系在一起的。如果任何人都能对此发光,那就太好了。
我在使用MFMailComposer后发生类似的崩溃问题。删除[myMailComposer发布]后,一切都很好。我确定我遵循内存管理规则,因为除了这个特定的地方,它在应用程序中都很好。现在我的“Build &分析”对此感到厌烦,但该应用程序非常稳定。
请试试这个适合我的代码。
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
switch (result)
{
case MFMailComposeResultCancelled:
{
break;
}
case MFMailComposeResultSaved:
{
break;
}
case MFMailComposeResultSent:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Email" message:@"Email Sent" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
[self performSegueWithIdentifier:@"backHome" sender: self];
break;
}
case MFMailComposeResultFailed:
{
NSLog(@" Failed");
break;
}
default:
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Email" message:@"Email Failed" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil];
[alert show];
}
break;
}
}