• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: What's the difference between [NSOperationQueue currentQueue] and performSelectorOnMainThread (iOS platform)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: What's the difference between [NSOperationQueue currentQueue] and performSelectorOnMainThread (iOS platform)


  • Subject: Re: What's the difference between [NSOperationQueue currentQueue] and performSelectorOnMainThread (iOS platform)
  • From: "Glenn L. Austin" <email@hidden>
  • Date: Tue, 05 Feb 2013 08:13:14 -0800

On Feb 4, 2013, at 8:58 AM, Kyle Sluder <email@hidden> wrote:

> On Sun, Feb 3, 2013, at 11:58 PM, 尹佳冀 wrote:
>> Thanks Mike seem You are right, and I write like this
>>
>> [self performSelector:@selector(doTheThing) withObject:nil
>> afterDelay:0.5];
>> it can work correctly.
>
> Magic constants like this are evil and are a serious indicator of poor
> programming practice. A computer with a faster or slower processor, or
> the same computer with more or fewer tasks going at once, can make your
> "working" code suddenly fail. Then you're back where you started.
>
> Please describe your problem in more detail so we may help you fix it
> the correct way.
>

+1

I understand the *reasoning* behind performSelector:withObject:afterDelay:, but I've banned that from code I work on.

I've yet to find a case where that was used that didn't point out a significant architectural flaw that was the cause for many user tech support calls about our product.  Fixing those flaws resolved the issue for using "afterDelay" -- and significantly improved the products' stability.

--
Glenn L. Austin, Computer Wizard and Race Car Driver         <><
<http://www.austin-soft.com>


_______________________________________________

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


  • Follow-Ups:
    • Re: What's the difference between [NSOperationQueue currentQueue] and performSelectorOnMainThread (iOS platform)
      • From: Steve Sisak <email@hidden>
References: 
 >What's the difference between [NSOperationQueue currentQueue] and performSelectorOnMainThread (iOS platform) (From: 尹佳冀 <email@hidden>)
 >Re: What's the difference between [NSOperationQueue currentQueue] and performSelectorOnMainThread (iOS platform) (From: Mike Abdullah <email@hidden>)
 >Re: What's the difference between [NSOperationQueue currentQueue] and performSelectorOnMainThread (iOS platform) (From: 尹佳冀 <email@hidden>)
 >Re: What's the difference between [NSOperationQueue currentQueue] and performSelectorOnMainThread (iOS platform) (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: NSDocument packages and incremental writing using NSFileWrapper
  • Next by Date: Re: NSTask Explodes. Clueless.
  • Previous by thread: Re: What's the difference between [NSOperationQueue currentQueue] and performSelectorOnMainThread (iOS platform)
  • Next by thread: Re: What's the difference between [NSOperationQueue currentQueue] and performSelectorOnMainThread (iOS platform)
  • Index(es):
    • Date
    • Thread