Re: Getting NSApplicationDelegate protocol
Re: Getting NSApplicationDelegate protocol
- Subject: Re: Getting NSApplicationDelegate protocol
- From: "Stephen J. Butler" <email@hidden>
- Date: Fri, 06 Jul 2012 04:14:23 -0500
On Fri, Jul 6, 2012 at 3:30 AM, ecir hana <email@hidden> 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 (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