Re: The use of UIActionSheet mysteriously disables our app with a white screen after memory warning.
Re: The use of UIActionSheet mysteriously disables our app with a white screen after memory warning.
- Subject: Re: The use of UIActionSheet mysteriously disables our app with a white screen after memory warning.
- From: Roland King <email@hidden>
- Date: Sat, 17 Mar 2012 10:53:43 +0800
You've sure had a lot of problems with this!
I just wrote a simple test app which has a Navigation Controller with Root, One and Two screens. Root has a 'one' button which transitions to One, One has a 'Two' button which transitions to 2, all pushes. Root and One both have 'Action' buttons which trigger the same modal screen (with different transitions) which asks if you really want to perform the action. If you say No, it cancels back to where you were, if you say Yes it presents a UIActionSheet with "RIP IT" or "Cancel", Cancel does the obvious, RIP IT (and I'm remembering your original post here where you wanted to push something onto the navigation stack underlying the modal sheet) queues up a push on the underlying view controller before dismissing. I put in a constant which says whether I want the new screen pushed before the modal screen dismisses (ie it just comes back like that) or it animates into place (which I like but I think you described as 'janky').
I can't make it fail wherever I simulate a memory warning. The views all unload as I would expect (it logs) and reload when I'd expect them to, they all show properly.
You want me to send you the zipped up project? I've used storyboards and segues because it was quick, but there's no magic there, I could have just as easily done it with hardcoded button actions pushing the controllers and modal sheets. if you have a sequence which makes this fail, please tell me what it is, I've mashed buttons for 20 minutes up and down and up and down again, making memory warnings all over the place and it just keeps working, both at the root of the nav controller and when you're one level down.
On Mar 16, 2012, at 4:58 PM, G S wrote:
> The situation is pretty simple: a view controller at the top of our
> navigation controller's stack presents a modal view controller.
>
> When the user's done with the modal view, he makes one of several choices
> that call the modal controller's delegate and cause the delegate to dismiss
> the modal view.
>
> The problem occurs if a memory warning comes through while the modal view
> is up. In that case, the view behind the modal view gets blown away.
> Normally, this isn't a problem; it's loaded from a XIB and designed to
> handle this situation anyway. And indeed, in two of the three ways that
> the user can dismiss the modal view, it works just fine.
>
> The third dismissal method leaves us with a blank white screen and a
> disabled app after the modal view is dismissed. There is only one
> difference in that case: The modal controller has presented a UIActionSheet
> to confirm the user's choice. If I add an action sheet to the other
> methods, they too cause the white screen. If I replace the UIActionSheet
> with a UIAlertView, the app works fine and the underlying view is redrawn
> as expected.
>
> Can anyone hazard a guess here? I'm handling the UIActionSheet
> with didDismissWithButtonIndex (which superseded clickedButtonWithIndex).
> I tried setting the ActionSheet's delegate to nil in this method, but no
> dice. I'm raising the ActionSheet with showFromBarButtonItem, but I also
> tried showInView:self.view.
>
> Through logging, I know that the view behind the modal view was reloaded
> and the XIB name was set correctly (viewDidLoad was called). But its
> viewWillAppear method was never called in the case where an ActionSheet was
> used by the overlying modal controller. When the ActionSheet isn't used by
> the modal controller, the underlying controller's viewWillAppear IS called
> and everything works fine.
>
> This was a pretty huge problem for our app, and before I file a bug I'd
> like to solicit insight on the issue.
>
> Thanks!
>
> Gavin
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden