• 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: Private Methods
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Private Methods


  • Subject: Re: Private Methods
  • From: Sean McBride <email@hidden>
  • Date: Tue, 18 Aug 2015 11:27:38 -0400
  • Organization: Rogue Research Inc.

On Tue, 18 Aug 2015 08:58:22 -0600, Richard Charles said:

>Apple documentation states that the "Names of most private methods in
>the Cocoa frameworks have an underscore prefix (for example, _fooData )
>to mark them as private.”
>
>I just ran into a case where one of my method names in a subclass
>replaced a private Cocoa framework method of the same name causing my
>application to crash in the next version of OS X. The private Cocoa
>framework method name did not have an underscore prefix. So the
>documentation is correct, “most” but not all private methods in the
>frameworks have an underscore prefix.

I'm not even sure "most" is true.  A large number of Apple methods do not start with underscore.

>I have never bothered doing this because for one reason BF_addObject
>looks so ugly as a method name.

Me neither.  I've hit only a few conflicts over the years, in which case I rename.

You can set the OBJC_PRINT_REPLACED_METHODS env var to help catch conflicts.  Always a good idea with beta version of major OS releases.

Cheers,

--
____________________________________________________________
Sean McBride, B. Eng                 email@hidden
Rogue Research                        www.rogue-research.com
Mac Software Developer              Montréal, Québec, Canada

_______________________________________________

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: Private Methods
      • From: Richard Charles <email@hidden>
References: 
 >Private Methods (From: Richard Charles <email@hidden>)

  • Prev by Date: Re: Private Methods
  • Next by Date: Re: Private Methods
  • Previous by thread: Re: Private Methods
  • Next by thread: Re: Private Methods
  • Index(es):
    • Date
    • Thread