app get crashed while navigating to RootViewController from Message popup

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 07:32:18

问题


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?


回答1:


In app delegate you are assigning the rootviewcontroller and in applicationDidBecomeActive you are redirecting into rootviewcontroller, why not to try directly assign the viewcontroller instead of rootviewcontroller.. You can at least try it, not sure it will work but still try once..




回答2:


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

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];

        }
}];


来源:https://stackoverflow.com/questions/20420202/app-get-crashed-while-navigating-to-rootviewcontroller-from-message-popup

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!