• 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
Getting NSApplicationDelegate protocol
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Getting NSApplicationDelegate protocol


  • Subject: Getting NSApplicationDelegate protocol
  • From: ecir hana <email@hidden>
  • Date: Fri, 06 Jul 2012 10:30:06 +0200

Hello,

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");

I saw (
http://stackoverflow.com/questions/10212119/objc-getprotocol-returns-null-for-nsapplicationdelegate)
that the it is because the protocol was not:

    Adopted by a class,
    Or referred to somewhere in source code (using @protocol())

As am doing this at runtime, I cannot use "@protocol()", right?

So I thought I will add the protocol to the class:

    Protocol *protocol = objc_getProtocol("NSApplicationDelegate");
    BOOL class_addProtocol(class, protocol);

The problem, obviously, is that I cannot add a protocol until it been
created and the protocol wont be created until used be a class.

Is there a way to get NSApplicationDelegate protocol besides the
compile-time "@protocol()"?

Also, when I do:

    Protocol *protocol = objc_getProtocol("NSTextViewDelegate");

return the protocol even when I didn't create any textviews...?

PS: To get all the method descriptions of a protocol, do I have to call
four times "protocol_getMethodDescription"?

    protocol_getMethodDescription(p, aSel, NO, NO);
    protocol_getMethodDescription(p, aSel, NO, YES);
    protocol_getMethodDescription(p, aSel, YES, NO);
    protocol_getMethodDescription(p, aSel, YES, YES);
_______________________________________________

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: Getting NSApplicationDelegate protocol
      • From: Ken Thomases <email@hidden>
    • Re: Getting NSApplicationDelegate protocol
      • From: "Stephen J. Butler" <email@hidden>
  • Prev by Date: wacky image stretching on rotation (repost)
  • Next by Date: Re: Getting NSApplicationDelegate protocol
  • Previous by thread: RE: wacky image stretching on rotation (repost)
  • Next by thread: Re: Getting NSApplicationDelegate protocol
  • Index(es):
    • Date
    • Thread