• 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: performSelector:onThread:withObject:waitUntilDone:' not found in protocol(s)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: performSelector:onThread:withObject:waitUntilDone:' not found in protocol(s)


  • Subject: Re: performSelector:onThread:withObject:waitUntilDone:' not found in protocol(s)
  • From: Greg Parker <email@hidden>
  • Date: Thu, 1 Apr 2010 11:43:14 -0700

On Apr 1, 2010, at 11:25 AM, Andreas Grosam wrote:
> Still, I see an advantage when using protocols. The argument of changing interfaces does not count IMO, since Categories are prone to changes as well. If sometimes the category get removed or the methods get changed, my code will not run anymore ;)
> I don't think this will happen, though.

But protocols have a worse versioning problem than classes or categories. It's not just removed or changed methods. You also cannot add methods to a protocol, but you can add methods to a class. That's why the new thread perform methods were added to class NSObject but were not added to protocol NSObject.

If you add a method to a class, all subclasses inherit that new implementation. Any old subclasses still honor the new interface without being recompiled.

If you add a method to a protocol, the classes that conform to the protocol do not get a new method implementation. Old classes therefore do not honor the new interface, even though -conformsToProtocol: returns YES.

The upshot is that you can add new methods to a class (with care toward other compatibility issues, of course), but that you can't add a new required method to a protocol unless you also control every class that conforms to that protocol.


--
Greg Parker     email@hidden     Runtime Wrangler


_______________________________________________

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

References: 
 >performSelector:onThread:withObject:waitUntilDone:' not found in protocol(s) (From: Andreas Grosam <email@hidden>)
 >Re: performSelector:onThread:withObject:waitUntilDone:' not found in protocol(s) (From: Greg Parker <email@hidden>)
 >Re: performSelector:onThread:withObject:waitUntilDone:' not found in protocol(s) (From: Andreas Grosam <email@hidden>)

  • Prev by Date: Re: Copy Folder Attributes of /dev
  • Next by Date: Re: NSLayerStack/NSArrayController/NSButton action puzzle
  • Previous by thread: Re: performSelector:onThread:withObject:waitUntilDone:' not found in protocol(s)
  • Next by thread: Copy Folder Attributes of /dev
  • Index(es):
    • Date
    • Thread