On Fri, Jul 6, 2012 at 3:30 AM, ecir hana <ecir.h...@gmail.com> wrote:
> I'm trying to get the methods a protocol specifies and just stumbled upon
> one problem: the following code returns NULL:
>
>     Protocol *protocol = objc_getProtocol("NSApplicationDelegate");

Are you trying this on 10.5? Or are you building this application with
the 10.5 SDK?

Before 10.6 the NSApplicationDelegate was an informal protocol (that
is, a category of methods on NSObject). This is because "@optional"
didn't appear till the 10.6 SDK/compiler and previous to that for
protocols:

1) all methods were mandatory
2) you couldn't extend the protocol later; once you publish it's set
of methods in a Framework you were fixed at that set

Point (2) follows from point (1) if you think about it enough.

So some of the protocols, like NSApplicationDelegate, weren't really
protocols at all. But in 10.6 they introduced "@optional", and
NSApplicationDelegate became a formal protocol.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to