本文介绍了从消息弹出窗口导航到RootViewController时,app崩溃了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 MFMessageComposeViewController 类来发送消息。我的应用程序在特定情况下崩溃。即,当消息UI弹出来时,用户按下主页按钮,应用程序进入后台,当回来时,我编写了代码以导航到根视图控制器 in applicationDidBecomeActive 委托。如果有任何建议,请告诉我?

I used MFMessageComposeViewController class for sending messages. My app get crashed in a particular situation. i e, When Message UI popup comes, user presses home button, app goes background and when come back, I wrote the code to navigate to the root view controller in applicationDidBecomeActive delegate. Please let me know if any suggestions?

推荐答案

我遇到了同样的问题,通过删除断点解决了这个问题,正如120hit建议的那样。

I had the same problem, and it was solved by removing the break points, as 120hit suggested.

但是,由于我需要断点检查代码,我发现原因是我的代码试图关闭一个ViewController,所以我将下一个代码放在完成块中:

But, since I needed the breakpoints to check the code, I found out that the reason was that my code tried to close a ViewController, so I put the "next code" inside the completion block:

 [presentingViewController dismissViewControllerAnimated:YES completion:^{
        self.currentMatch = match;

        GKTurnBasedParticipant *firstParticipant =
        [match.participants objectAtIndex:0];

        if (firstParticipant.lastTurnDate) {
            [delegate takeTurn:match];
        } else {
            [delegate enterNewGame:match];

        }
}];

这篇关于从消息弹出窗口导航到RootViewController时,app崩溃了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 01:52