Когда я пытаюсь использовать MFMailComposeViewController на устройстве, я получаю приведенный ниже журнал сбоя.
Он открывает модальное представление, когда я пытаюсь запустить его на симуляторе.
Это код, который я использую:
stringHTML
и html
- строки HTML.
stringHTML
имеет тип NSString, а html
имеет тип NSMutableString.
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate = self;
[mailController setSubject:@"Email"];
NSLog(@"%@",html);
NSString *stringHTML=html;
NSLog(@"%@",stringHTML);
[mailController setMessageBody:stringHTML isHTML:YES];
[self presentModalViewController:mailController animated:YES];
[mailController release];
Что может быть не так?
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Application tried to present a nil modal view controller on target <QuizReportsView: 0x411af0>.'
*** Call stack at first throw:
(
0 CoreFoundation 0x3737364f __exceptionPreprocess + 114
1 libobjc.A.dylib 0x33a30c5d objc_exception_throw + 24
2 UIKit 0x31350fcf -[UIViewController presentModalViewController:withTransition:] + 546
3 UIKit 0x31350cd7 -[UIViewController presentModalViewController:animated:] + 58
4 Vocab 0x0007d1bf -[QuizReportsView actionSheet:clickedButtonAtIndex:] + 270
5 UIKit 0x313c603d -[UIActionSheet(Private) _buttonClicked:] + 192
6 CoreFoundation 0x372e3571 -[NSObject(NSObject) performSelector:withObject:withObject:] + 24
7 UIKit 0x312c3ec9 -[UIApplication sendAction:to:from:forEvent:] + 84
8 UIKit 0x312c3e69 -[UIApplication sendAction:toTarget:fromSender:forEvent:] + 32
9 UIKit 0x312c3e3b -[UIControl sendAction:to:forEvent:] + 38
10 UIKit 0x312c3b8d -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 356
11 UIKit 0x312c4423 -[UIControl touchesEnded:withEvent:] + 342
12 UIKit 0x312c2bf5 -[UIWindow _sendTouchesForEvent:] + 368
13 UIKit 0x312c256f -[UIWindow sendEvent:] + 262
14 UIKit 0x312ab313 -[UIApplication sendEvent:] + 298
15 UIKit 0x312aac53 _UIApplicationHandleEvent + 5090
16 GraphicsServices 0x31c36e77 PurpleEventCallback + 666
17 CoreFoundation 0x3734aa97 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 26
18 CoreFoundation 0x3734c83f __CFRunLoopDoSource1 + 166
19 CoreFoundation 0x3734d60d __CFRunLoopRun + 520
20 CoreFoundation 0x372ddec3 CFRunLoopRunSpecific + 230
21 CoreFoundation 0x372dddcb CFRunLoopRunInMode + 58
22 GraphicsServices 0x31c3641f GSEventRunModal + 114
23 GraphicsServices 0x31c364cb GSEventRun + 62
24 UIKit 0x312d5d69 -[UIApplication _run] + 404
25 UIKit 0x312d3807 UIApplicationMain + 670
26 Vocab 0x00002223 main + 82
27 Vocab 0x000021cc start + 40
)
terminate called after throwing an instance of 'NSException'