0

So I run the code below to present the mail form, and it crashes on me. I run out of ideas at this point. Anyone?

Code:

Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));

if (mailClass != nil && [mailClass canSendMail])
{
    MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
    picker.mailComposeDelegate = self;

    [picker setSubject:@"Subject"];

    [self presentViewController:picker animated:YES completion:nil];
}  

But it crashes

-[UIDeviceRGBColor shadowOffset]: unrecognized selector sent to instance 0xc135710  


0   CoreFoundation                      0x02c2f1e4 __exceptionPreprocess + 180
1   libobjc.A.dylib                     0x028f98e5 objc_exception_throw + 44
2   CoreFoundation                      0x02ccc243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3   CoreFoundation                      0x02c1f50b ___forwarding___ + 1019
4   CoreFoundation                      0x02c1f0ee _CF_forwarding_prep_0 + 14
5   UIKit                               0x014763fe -[UINavigationItemView _currentTextShadowOffsetForBarStyle:] + 132
6   UIKit                               0x014766b2 -[UINavigationItemView _updateLabelContents] + 396
7   UIKit                               0x01476ef1 -[UINavigationItemView _titleSize] + 51
8   UIKit                               0x01476806 -[UINavigationItemView _labelFrame] + 80
9   UIKit                               0x01475f60 -[UINavigationItemView initWithNavigationItem:] + 416
10  UIKit                               0x0144ad5a -[UINavigationItem _defaultTitleView] + 116
11  UIKit                               0x01447808 -[UINavigationItem _addDefaultTitleViewToNavigationBarIfNecessary] + 50
12  UIKit                               0x01447eb2 -[UINavigationItem setTitle:] + 212
13  MessageUI                           0x0073ac96 -[MFMailComposeInternalViewController viewDidLoad] + 593
14  UIKit                               0x014cb33d -[UIViewController loadViewIfRequired] + 696  

Notes: my class is a MFMailComposeViewControllerDelegate and I do implement the required method.

- (void)mailComposeController:(MFMailComposeViewController*)controller
          didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error

1 Answer 1

0

My mistake. It was caused by using the appearance proxy, but then not having a top navigation bar.

So I set the [UINavigationBar appearance] but then I have changed my mind during the project and went with UI without the default navigation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.