所以我运行下面的代码来呈现邮件表单,它就崩溃了。我现在已经没想到了。任何人吗?
代码:
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];
}
但它崩溃了
-[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
注意:我的班级是MFMailComposeViewControllerDelegate
,我确实实现了所需的方法。
- (void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
答案 0 :(得分:0)
我的错误。它是由使用外观代理引起的,但后来没有顶部导航栏。
所以我设置了 [UINavigationBar外观] 但是我在项目期间改变了主意,没有使用默认导航的UI。