Re: Multiple simultaneous UIAlertControllers
Re: Multiple simultaneous UIAlertControllers
- Subject: Re: Multiple simultaneous UIAlertControllers
- From: Tomasz Muszyński <email@hidden>
- Date: Fri, 06 Nov 2015 22:53:26 +0100
> Wiadomość napisana przez Carl Hoefs <email@hidden> w dniu 06.11.2015, o godz. 22:45:
>
>
>> On Nov 6, 2015, at 2:43 PM, Tomasz Muszyński <email@hidden> wrote:
>>
>>>
>>> Wiadomość napisana przez Carl Hoefs <email@hidden> w dniu 06.11.2015, o godz. 22:39:
>>>
>>>> On Nov 6, 2015, at 2:38 PM, Tomasz Muszyński <email@hidden> wrote:
>>>>
>>>>>
>>>>> Wiadomość napisana przez Carl Hoefs <email@hidden> w dniu 06.11.2015, o godz. 22:33:
>>>>>
>>>>> On Nov 5, 2015, at 3:53 PM, Eric E Dolecki <email@hidden> wrote:
>>>>>>
>>>>>> That's the way. You should never need more than one presented at a time.
>>>>>>
>>>>>>
>>>>>>> On Nov 5, 2015, at 5:44 PM, Tomasz Muszyński <email@hidden> wrote:
>>>>>>>
>>>>>>> You should present next UIAlertController when first one has been dismissed (when UIAlertAction handler is called).
>>>>>
>>>>> Now that I have an NSOperationQueue handling the serialized presentation of the UIAlertControllers, I'm getting this warning:
>>>>>
>>>>> Warning: Attempt to present <UIAlertController: 0x173c7800> on <RootViewController: 0x16d4ae20> whose view is not in the window hierarchy!
>>>>>
>>>>> So far as I understand it, the view *is* in the window hierarchy, modally. What to do?
>>>>
>>>> You try to present your alert on RootViewController instead of other view controller which is on top (currently visible). On your first post you wrote about MyViewController.
>>>>
>>>> tm
>>>
>>> I have background threads running that generate alerts. On which ViewController do I execute the alerts?
>>
>> I already wrote - on top view controller. But I think you have probably wrong app architecture. Background threads should not present alerts, but they should store somewhere their messages and present them (maybe as one big alert) when background thread is finished. I’m just guessing…
>>
>> tm
>
> The background threads don't execute the alerts, but they enqueue them onto the NSOperationQueue, where they are executed on the top (root) view controller. But I get this warning, and the alerta are never displayed.
You are queuing them on background thread and queue probably executes them immediately. I’m not sure what you are trying to achieve and why background thread creates many alerts. This will be annoying for the user. You should only store (error?) messages and present them when background thread is finished. If you have to present all that messages maybe UIAlertController is wrong solution for that and just use UITableView with list of messages. Also, your background thread probably doesn’t know which view controller is currently present on top, that’s why you should not create UIAlertController’s on background thread. If background thread generates messages, then it should notify somehow (eg notification center) currently visible view controller to present an alert.
tm
_______________________________________________
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