• 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: Calling original method implementation from category
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Calling original method implementation from category


  • Subject: Re: Calling original method implementation from category
  • From: Ondra Cada <email@hidden>
  • Date: Mon, 25 Apr 2005 17:52:18 +0200

Georg,

On 25.4.2005, at 10:31, Georg Tuparev wrote:

I need to add a NSError category. The category implementation of -domain needs to call the original NSError's -domain method. Here what I am doing:

You can't do this an easy way. When a category gets loaded, its method implementation *replaces* the original one, rendering it, from the class structure point of view, effectively nonexistent.


Commonly, this is being solved with poseAsClassing, or (less common, but sometimes needed too) replacing the IMP with another method's IMP (I won't provide the code since it's exactly what Axel Anderson already did).

Another possibility, if you don't want to mess with the runtime that much, would be a two-stage bundle, which first stores the original IMP, and only then loads the second-stage bundle with the category.
---
Ondra Čada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc


_______________________________________________
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: 
 >Calling original method implementation from category (From: Georg Tuparev <email@hidden>)

  • Prev by Date: Bindings and a custom NSCell in a NSTableView
  • Next by Date: Re: Printing issues
  • Previous by thread: Re: Calling original method implementation from category
  • Next by thread: Re: Calling original method implementation from category
  • Index(es):
    • Date
    • Thread