if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
mailViewController.mailComposeDelegate = self;
[mailViewController setSubject:@"Support Enquiry"];
[mailViewController setToRecipients:[NSArray arrayWithObject:EMAIL_SUPPORT]];
[self presentModalViewController:mailViewController animated:YES];
[mailViewController release];
}
My code crashes on the
MFMailComposeViewController *mailViewController = [[MFMailComposeViewController alloc] init];
line with:
*** Terminating app due to uncaught exception 'CALayerInvalidGeometry',
reason: 'CALayer position contains NaN: [nan 24.5]'
*** Call stack at first throw:
(
0 CoreFoundation 0x011f75a9 __exceptionPreprocess + 185
1 libobjc.A.dylib 0x0134b313 objc_exception_throw + 44
2 CoreFoundation 0x011afef8 +[NSException raise:format:arguments:] + 136
3 CoreFoundation 0x011afe6a +[NSException raise:format:] + 58
4 QuartzCore 0x00145ba2 _ZL18CALayerSetPositionP7CALayerRKN2CA4Vec2IdEEb + 177
5 QuartzCore 0x00145d55 -[CALayer setPosition:] + 42
6 QuartzCore 0x0013e24d -[CALayer setFrame:] + 763
7 UIKit 0x0047eda2 -[UIView(Geometry) setFrame:] + 255
8 UIKit 0x004ea660 -[UITextField setFrame:] + 166
9 MessageUI 0x001faa48 -[_MFComposeRecipientView reflow] + 3371
10 MessageUI 0x001f9678 -[_MFComposeRecipientView setLabel:] + 79
11 MessageUI 0x001ff144 -[MFMailComposeView _setupField:withLabel:navTitle:property:changingView:toSize:fieldFrame:visible:] + 234
12 MessageUI 0x00203277 -[MFMailComposeView _layoutSubviews:changingView:toSize:searchResultsWereDismissed:] + 1768
13 MessageUI 0x001fea6f -[MFMailComposeView _layoutSubviews:changingView:toSize:] + 71
14 MessageUI 0x001fea22 -[MFMailComposeView _layoutSubviews:] + 69
15 MessageUI 0x00200859 -[MFMailComposeView initWithFrame:navigationItem:options:delegate:] + 2175
16 MessageUI 0x00215ea6 -[MFMailComposeController initializeUI] + 228
17 MessageUI 0x0021cfb9 -[MFMailComposeController initForContentSize:navigationItem:options:] + 147
18 MessageUI 0x00236267 -[MFMailComposeRootViewController initWithCompositionContext:contentSize:mailComposeControllerOptions:] + 377
19 MessageUI 0x0022fbe7 -[MFMailComposeViewController initWithComposition:contentSize:mailComposeControllerOptions:] + 726
20 MessageUI 0x0022f634 -[MFMailComposeViewController initWithComposition:] + 68
21 MessageUI 0x0022f71e -[MFMailComposeViewController initWithNibName:bundle:] + 98
...
Any idea whats going on?
EDIT: All the answer so far have done nothing, it still crashes :(
EDIT 2: I finally figured out the problem - I had added a category to text field and MFMailComposeViewController did not like that at all.
As the asker reported on his question, MFMailComposeViewController
uses some native elements that shouldn't be categorized. So, you have to be sure there aren't any categories on elements like UITextField
or UITextView
.