<i id='qVzBg'><tr id='qVzBg'><dt id='qVzBg'><q id='qVzBg'><span id='qVzBg'><b id='qVzBg'><form id='qVzBg'><ins id='qVzBg'></ins><ul id='qVzBg'></ul><sub id='qVzBg'></sub></form><legend id='qVzBg'></legend><bdo id='qVzBg'><pre id='qVzBg'><center id='qVzBg'></center></pre></bdo></b><th id='qVzBg'></th></span></q></dt></tr></i><div id='qVzBg'><tfoot id='qVzBg'></tfoot><dl id='qVzBg'><fieldset id='qVzBg'></fieldset></dl></div>

    <tfoot id='qVzBg'></tfoot>
      <bdo id='qVzBg'></bdo><ul id='qVzBg'></ul>

    1. <legend id='qVzBg'><style id='qVzBg'><dir id='qVzBg'><q id='qVzBg'></q></dir></style></legend>
    2. <small id='qVzBg'></small><noframes id='qVzBg'>

      presentModalViewController 使我的应用程序崩溃

      时间:2023-05-16
    3. <i id='XqxJW'><tr id='XqxJW'><dt id='XqxJW'><q id='XqxJW'><span id='XqxJW'><b id='XqxJW'><form id='XqxJW'><ins id='XqxJW'></ins><ul id='XqxJW'></ul><sub id='XqxJW'></sub></form><legend id='XqxJW'></legend><bdo id='XqxJW'><pre id='XqxJW'><center id='XqxJW'></center></pre></bdo></b><th id='XqxJW'></th></span></q></dt></tr></i><div id='XqxJW'><tfoot id='XqxJW'></tfoot><dl id='XqxJW'><fieldset id='XqxJW'></fieldset></dl></div>

          • <legend id='XqxJW'><style id='XqxJW'><dir id='XqxJW'><q id='XqxJW'></q></dir></style></legend>
              <tbody id='XqxJW'></tbody>
          • <small id='XqxJW'></small><noframes id='XqxJW'>

            • <bdo id='XqxJW'></bdo><ul id='XqxJW'></ul>

                <tfoot id='XqxJW'></tfoot>
                本文介绍了presentModalViewController 使我的应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                限时送ChatGPT账号..

                我知道,这是最简单的事情之一.但是我这几天一直在反对这个.过去我已经做过很多次了,但由于某种原因,试图呈现模态视图控制器只会使应用程序崩溃到黑屏.控制台中没有任何报告或任何内容.我希望有人可能遇到过这个问题并提供一些建议.

                It's one of the simplest things to do, I know. But I've been banging my head against this for days. I've done it plenty of times in the past, but for some reason trying to present a modal view controller just crashes the app to a black screen. Nothing reported in the console or anything. I'm hoping someone might have had this problem and has some advice.

                这段代码是从 UIViewController 类调用的:

                This code is called from a UIViewController class:

                MFMailComposeViewController *controller = [[MFMailComposeViewController alloc] init];
                controller.mailComposeDelegate = self;
                [controller setSubject:@"test subject"];
                [controller setMessageBody:@"this is the message body" isHTML:NO];
                [self presentModalViewController:controller animated:YES];
                

                推荐答案

                在尝试显示 MFMailComposeViewController 之前是否显示另一个模态视图控制器?我遇到了同样的问题并找到了解决方法:

                Are you showing another modal view controller before trying to show MFMailComposeViewController? I had the same problem and found a workaround:

                - (void)peopleMultiPickerNavigationController:(PeopleMultiPickerNavigationController *)peoplePicker 
                                                didSelectContacts:(NSArray *)contacts {
                
                [self dismissModalViewControllerAnimated:YES];
                
                // some more code here
                
                [self performSelector:@selector(sendEmail) withObject:nil afterDelay:0.45]; // this works only if delay > ~0.4!
                // [self sendEmail]; // this won't work
                
                // some more code here
                
                }
                
                - (void) sendEmail {
                  Class mailClass = (NSClassFromString(@"MFMailComposeViewController"));
                  if (mailClass != nil) {
                    // We must always check whether the current device is configured for sending emails
                    if ([mailClass canSendMail]) {
                      [self displayComposerSheet:emails];
                    } else {
                      [self launchMailAppOnDevice:emails];
                    }
                  } else {
                    [self launchMailAppOnDevice:emails];
                  } 
                }
                

                我知道这是一个丑陋的解决方法,但我没有找到更好的方法:(

                I know it's an ugly workaround, but I didn't found anything better :(

                这篇关于presentModalViewController 使我的应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:如何将关闭按钮添加到 UIModalPresentationPageSheet 中显示的模态视图角? 下一篇:显示模态视图时使 iPhone 状态栏消失?

                相关文章

                <small id='bB9TU'></small><noframes id='bB9TU'>

                <tfoot id='bB9TU'></tfoot>
                  <bdo id='bB9TU'></bdo><ul id='bB9TU'></ul>

                  1. <legend id='bB9TU'><style id='bB9TU'><dir id='bB9TU'><q id='bB9TU'></q></dir></style></legend>

                  2. <i id='bB9TU'><tr id='bB9TU'><dt id='bB9TU'><q id='bB9TU'><span id='bB9TU'><b id='bB9TU'><form id='bB9TU'><ins id='bB9TU'></ins><ul id='bB9TU'></ul><sub id='bB9TU'></sub></form><legend id='bB9TU'></legend><bdo id='bB9TU'><pre id='bB9TU'><center id='bB9TU'></center></pre></bdo></b><th id='bB9TU'></th></span></q></dt></tr></i><div id='bB9TU'><tfoot id='bB9TU'></tfoot><dl id='bB9TU'><fieldset id='bB9TU'></fieldset></dl></div>