我正在開發一個應用程序,允許用戶通過郵件拍照併發送(xcode版本5.1.1)。郵件發送後,確認彈出消息:iOS應用程序崩潰點擊按鈕
- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error{
switch (result)
{
case MFMailComposeResultCancelled:
[[[UIAlertView alloc]initWithTitle:@"Message Cancelled" message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]show];
break;
case MFMailComposeResultSent:
[[[UIAlertView alloc]initWithTitle:@"Message Sent" message:@"Thank you for your help." delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]show]; break;
default:
break;
}
[self dismissViewControllerAnimated:NO completion:nil];
}
關於在模擬器「OK」點擊,Xcode中突出了main.m文件代碼,短語「主題1:信號SIGABRT」 :
int main(int argc, char * argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}
}
當我在iPhone上測試的應用程序,同樣的事情,它點擊OK時崩潰。
你對如何解決這個問題有什麼想法嗎?
提前感謝您的幫助和建議
嘗試添加異常斷點並重現崩潰:http://stackoverflow.com/questions/17802662/exception-breakpoint-in-xcode – BergQuester
我無法重現您的問題。用我的測試中的委託方法顯示alertView。你向viewController聲明瞭'MFMailComposeViewControllerDelegate'?請顯示您如何調用'MFMailComposeViewController'並設置郵件。 – Sebastian
要了解如何調試,請參閱http://www.raywenderlich.com/10209/my-app-crashed-now-what-part-1 – rmaddy