• 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: Patching implementation in +load. Was: …Mapping Model : Spurious Warning
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patching implementation in +load. Was: …Mapping Model : Spurious Warning


  • Subject: Re: Patching implementation in +load. Was: …Mapping Model : Spurious Warning
  • From: Kyle Sluder <email@hidden>
  • Date: Tue, 7 Sep 2010 16:06:58 -0700

On Tue, Sep 7, 2010 at 3:55 PM, Kyle Sluder <email@hidden> wrote:
> Since all you're doing is adding methods, +load might be an okay time
> to do things, except if the method you're replacing comes from a
> category. You might want to defer to +initialize instead.

For the record, this is still risky business. As bbum's article says,
a category's +initialize implementation replaces the class's. Though
it's a bad idea to implement +initialize in a category, and certainly
a bug to implement it in more than one category or in both a category
and the main implementation, since Core Data is a black box it's quite
possible that the Core Data developers trust themselves enough to
implement critical methods like +initialize in internal categories.

At Omni, we use a custom +initialize-esque method called +didLoad that
was originally written to avoid bugs in NeXTSTEP. It relies on the
application invoking OBPostLoader sometime early in the application's
life—just as Apple's article advises you to do with this method swap.

OBPostLoader is part of the OmniBase framework, found here on github:
http://github.com/omnigroup/OmniGroup/tree/master/Frameworks/OmniBase/

As always, please read the license before using the Omni Frameworks
source code. (Don't worry, it's not long.)

--Kyle Sluder
_______________________________________________

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

References: 
 >Compiling Core Data Mapping Model : Spurious Warning re 10.5 Deployment? (From: Jerry Krinock <email@hidden>)
 >Re: Compiling Core Data Mapping Model : Spurious Warning re 10.5 Deployment? (From: Quincey Morris <email@hidden>)
 >Re: Compiling Core Data Mapping Model : Spurious Warning re 10.5 Deployment? (From: Jerry Krinock <email@hidden>)
 >Patching implementation in +load. Was: …Mapping Model : Spurious Warning (From: Jerry Krinock <email@hidden>)
 >Re: Patching implementation in +load. Was: …Mapping Model : Spurious Warning (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Patching implementation in +load. Was: …Mapping Model : Spurious Warning
  • Next by Date: NSNumber compare: Giving Unexpected Results
  • Previous by thread: Re: Patching implementation in +load. Was: …Mapping Model : Spurious Warning
  • Next by thread: NSInputStream Overflow?
  • Index(es):
    • Date
    • Thread