问题
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