从消息弹出窗口导航到RootViewController时,app崩溃了

时间:2013-12-06 09:21:33

标签: ios iphone objective-c mfmessagecomposeview

我使用MFMessageComposeViewController类来发送消息。我的应用程序在特定情况下崩溃。即,当消息UI弹出窗口出现时,用户按下主页按钮,应用程序返回后台,当我回来时,我编写了代码以导航到root view controller委托中的applicationDidBecomeActive。如果有任何建议,请告诉我?

2 个答案:

答案 0 :(得分:0)

在应用委托中,您分配的是rootviewcontroller,而applicationDidBecomeActive正在重定向到rootviewcontroller,为什么不尝试直接分配viewcontroller而不是rootviewcontroller你至少可以尝试一下,不确定它会起作用,但仍然可以尝试一次..

答案 1 :(得分:0)

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

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

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

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

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

        }
}];
相关问题