• 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: [OBJ-C] Remove Warning for Undocumented Call?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [OBJ-C] Remove Warning for Undocumented Call?


  • Subject: Re: [OBJ-C] Remove Warning for Undocumented Call?
  • From: "M. Uli Kusterer" <email@hidden>
  • Date: Sat, 2 Oct 2004 21:56:25 +0200

At 13:49 Uhr -0400 02.10.2004, Gwynne wrote:

I will emphasize again that using undocumented methods is generally an extremely bad idea. Think long and hard about why you're doing it and whether there's another way to do what you want done. If there isn't, then file a bug report with Apple for missing functionality and be prepared for your code to break in a future system release.

Another danger when using undocumented APIs is that Apple may not remove the symbol but rather change the type of one of its parameters. Then, instead of a link error at startup, you'll get a real crash.

That being said, there's a way to at least make use of undocumented methods a little safer:

Before you call it, use respondsToSelector: to make sure the method is still available. That way, you'll know when Apple removed things underneath you and you can either fall back to less efficient but also working code, or you can at least fail gracefully and tell the user to ask for an update.

Similarly, using undocumented functions should use NSBundle (CFBundle? I don't recall right now whether NSBundle exposes that part of CFBundle), or - if you can require 10.2 or later - weak linking and check whether the symbol is really available.
--
Cheers,
M. Uli Kusterer
------------------------------------------------------------
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
References: 
 >[OBJ-C] Remove Warning for Undocumented Call? (From: Lance Drake <email@hidden>)
 >Re: [OBJ-C] Remove Warning for Undocumented Call? (From: Gwynne <email@hidden>)

  • Prev by Date: Re: [NEWBIE]: Dynamically loading NSViews
  • Next by Date: NSDocument New ?
  • Previous by thread: Re: [OBJ-C] Remove Warning for Undocumented Call?
  • Next by thread: Re: [OBJ-C] Remove Warning for Undocumented Call?
  • Index(es):
    • Date
    • Thread