ios – 使用MFMailComposeViewController打开presentModalViewController时崩溃

前端之家收集整理的这篇文章主要介绍了ios – 使用MFMailComposeViewController打开presentModalViewController时崩溃前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
一个用户报告我的应用程序在点击电子邮件按钮后立即崩溃.但是我无法在同一规格的设备上重现问题.

附加崩溃日志.我调用[self presentModalViewController:controller animated:YES];在我的报告VC.m.控制器是MFMailComposeViewController的一个实例.

  1. Incident Identifier: 4A06DE9B-178C-43C2-AE23-D8C7EEED7831
  2. CrashReporter Key: 8b802dcda2f9dfd70003b0bedceac04ef79730f0
  3. Hardware Model: iPad3,6
  4. Process: ATracker [5610]
  5. Path: /var/mobile/Applications/ACABBAE7-C701-48AD-9DAC-9B4C0ABD3CFF/ATracker.app/ATracker
  6. Identifier: ATracker
  7. Version: ??? (???)
  8. Code Type: ARM (Native)
  9. Parent Process: launchd [1]
  10.  
  11. Date/Time: 2013-07-15 18:42:30.776 +0100
  12. OS Version: iOS 6.1.3 (10B329)
  13. Report Version: 104
  14.  
  15. Exception Type: EXC_CRASH (SIGABRT)
  16. Exception Codes: 0x0000000000000000,0x0000000000000000
  17. Crashed Thread: 0
  18.  
  19. Last Exception Backtrace:
  20. 0 CoreFoundation 0x3286c3e2 __exceptionPreprocess + 158
  21. 1 libobjc.A.dylib 0x3a70695e objc_exception_throw + 26
  22. 2 UIKit 0x34767118 -[UIViewController presentViewController:withTransition:completion:] + 3764
  23. 3 UIKit 0x34888d9e -[UIViewController presentModalViewController:animated:] + 26
  24. 4 ATracker 0x0007fac2 -[ReportVC sendEmail:] (ReportVC.m:1936)
  25. 5 UIKit 0x34766082 -[UIApplication sendAction:to:from:forEvent:] + 66
  26. 6 UIKit 0x34766036 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 26
  27. 7 UIKit 0x34766010 -[UIControl sendAction:to:forEvent:] + 40
  28. 8 UIKit 0x347658c6 -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 498
  29. 9 UIKit 0x34765db4 -[UIControl touchesEnded:withEvent:] + 484
  30. 10 UIKit 0x3468e5f4 -[UIWindow _sendTouchesForEvent:] + 520
  31. 11 UIKit 0x3467b8dc -[UIApplication sendEvent:] + 376
  32. 12 UIKit 0x3467b1ea _UIApplicationHandleEvent + 6194
  33. 13 GraphicsServices 0x3636f5f2 _PurpleEventCallback + 586
  34. 14 GraphicsServices 0x3636f222 PurpleEventCallback + 30
  35. 15 CoreFoundation 0x328413e2 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 30
  36. 16 CoreFoundation 0x32841386 __CFRunLoopDoSource1 + 134
  37. 17 CoreFoundation 0x3284020a __CFRunLoopRun + 1378
  38. 18 CoreFoundation 0x327b3238 CFRunLoopRunSpecific + 352
  39. 19 CoreFoundation 0x327b30c4 CFRunLoopRunInMode + 100
  40. 20 GraphicsServices 0x3636e336 GSEventRunModal + 70
  41. 21 UIKit 0x346cf2b4 UIApplicationMain + 1116
  42. 22 ATracker 0x00044fe6 main (main.m:16)
  43. 23 ATracker 0x00044f9c start + 36

任何想法或提示表示赞赏!

解决方法

应检测设备canSendMail
  1. [MFMailComposeViewController canSendMail]

如果设备上没有邮件帐户,则返回false.

@see https://stackoverflow.com/a/3671759/946434

猜你在找的iOS相关文章