tags:

views:

107

answers:

4

I'm doing the following:

[self.parentViewController dismissModalViewControllerAnimated:YES]  

This code fails using the Simulator but works with no issues on the phone itself. The Simulator's console shows no erros. I used NSLog statements to pinpoint this line of code as the culprit. When running on the phone, however, the console(window>organizer) shows that the above code is executed and the application proceeds forward with no problem.

When running the code in debugger, the following statement appears at the bottom of the Xcode debug window: GDB: Data Formatters temporarily unavailable, will re-try after a 'continue'. (Not safe to call dlopen at this time.)

Then a window dispalys stating: Loading 43672 stack frames. (that sounds bad)

In the debug window the following line appears numerous times: [UIView(Hierarchy) _makeSubtreePerformSelector:withObject:withObject:copySublayers:]

Without getting too deep into my code, does anyone know about or have experience with this type of condition?

Thanks

A: 

I think where you are calling this from is key but you don't say where this code is.

I suspect that dismissing your parentVC is causing this code to get executed again, which tries to dismiss the parent again... basically an infinite loop.

progrmr
+1  A: 

Why you don't just call [self dismissModalViewControllerAnimated:YES]. It is quite enough to close you modal view controller.

I know, it isn't answer for your question, but maybe it helps to avoid your issue.

Aleksejs
A: 

Thanks for the responses.

Aleksejs - I've tried your suggestion with no success. Thanks for making sure I've done the obvious first.

progrmr - I think you are probably correct - when and where I dismiss the modal view is the key and I'll look into how I'm doing this. I may need to re-architect how I'm handling my views.

This is frustrating because the issue does not happen on the iphone itself, only in the Simulator. And, I just confirmed that with the same MacBook Pro the error does not present itself in the Simulator when I'm working from home - the problem only occurs at my office. Strange, eh?

I'll keep digging and report my findings.

Thanks again.

Jon
@Jon: If you get an answer to your question that solves your problem it would be nice if you accept it by clicking on the checkmark.
progrmr
A: 

Update - I didn't solve the problem but instead avoided it by re-structuring things. Before, in applicationDidFinishLaunching:, I presented a Login view controller as a modal view. I then need to display a EULA view controller so the user can agree to some legal stuff. I think my problem was that I was presenting the EULA view as a modal from the Login view (which is also modal). The order in which the modals were being presented/dismissed, I think, was the problem (as progrmr had suspected).

How I avoided the issue? I took the time to learn about the delegation pattern. Now, each modal view (Login and EULA) are presented within the app delegate class and I use delegates to callback when certain actions are taken on the modal views.

Jon