Re: Display a UIAlertView after dismissing an action sheet?
Re: Display a UIAlertView after dismissing an action sheet?
- Subject: Re: Display a UIAlertView after dismissing an action sheet?
- From: Roland King <email@hidden>
- Date: Sat, 25 Apr 2015 22:02:45 +0800
> On 25 Apr 2015, at 21:30, Michael Crawford <email@hidden> wrote:
>
> On 4/25/15, Mike Abdullah <email@hidden> wrote:
>> Apple's APIs here are deliberately asynchronous. You need to make your code
>> handle that properly. Don't try to force it to be synchronous.
>
> Some things need to be synchronous though. If I'm saving a file, I
> don't want to do anything else unless the file is saved, or perhaps
> the operation is cancelled by the user.
There are always ways to use asynchronous APIs to appear to be synchronous.
>
> What's your take on the following? I found the bit with the runloop
> at stackoverflow.
>
….
>
> while( [alertView isVisible] ){
> NSRunLoop *rl = [NSRunLoop currentRunLoop];
> NSDate *today = [[NSDate alloc] init];
>
> [rl runUntilDate: today];
> [today release];
>
> }
yeah that’s the sort of hacky bad code I see on StackOverflow all the time. Running runloops inside the main runloop, not a good idea, Might work today, might not work tomorrow. The main runloop does lots more than it used to, integrates with the main dispatch queue, who knows what else. Running nested runloops to pretend force synchronous isn’t something I’d do.
_______________________________________________
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