• 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
-methodForSelector: doesn't fail when it should
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

-methodForSelector: doesn't fail when it should


  • Subject: -methodForSelector: doesn't fail when it should
  • From: Andrew Duncan <email@hidden>
  • Date: Mon, 23 Sep 2002 16:32:24 -0700

Cocoa docs say that calls to -methodForSelector: will cause a
runtime error if the specified selector is not handled. But I can
call [[NSObject new] methodForSelector:@selector(glog)] and get an
apparently valid pointer back. It's in the same memory range as the
result I get back from asking about a valid selector like self.

Apparently even though "glog" doesn't appear as a method name anywhere, it gets a valid SEL pointer set up. But that's a side-issue. Surely I shouldn't get a valid result from -methodForSelector:. What's up? How do I detect failure, apart from checking first with -respondsToSelector:?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • [Q] Calling isEmpty on an NSRange?
      • From: Ando Sonenblick <email@hidden>
  • Prev by Date: Driving Word X from Cocoa.
  • Next by Date: Re: Driving Word X from Cocoa.
  • Previous by thread: Re: Driving Word X from Cocoa.
  • Next by thread: [Q] Calling isEmpty on an NSRange?
  • Index(es):
    • Date
    • Thread