• 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
Switching methods in private classes in Apple frameworks
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Switching methods in private classes in Apple frameworks


  • Subject: Switching methods in private classes in Apple frameworks
  • From: Gideon King <email@hidden>
  • Date: Fri, 12 Mar 2010 10:24:08 +1000

(following on from the thread "How to debug this error on closing a document?", but it's really moved on to a new topic at this point)

I was not aware that poseAsClass is not available in 64 bit applications. I looked at the Apple example of exchanging a method in NSWindow, and it looked easy enough, so I tried the method exchanging by using class-dump to generate the header for NSConcreteNotification, and implemented the switch, but it gives a linker error:

"_OBJC_CLASS_$_NSConcreteNotification", referenced from:
l_OBJC_$_CATEGORY_NSConcreteNotification_$_MethodReplacement in MyConcreteNotification.o
__objc_classrefs__DATA@0 in MyConcreteNotification.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

So it must be in the foundation binary, but the linker doesn't pick it up. Is there a way around this?


Gideon




On 12/03/2010, at 2:00 AM, Jerry Krinock wrote:

>
> On 2010 Mar 11, at 02:27, Gideon King wrote:
>
>> or whether I would have to subclass NSConcreteNotification and override dealloc and then use pose as, so I could  print out the notification name etc, to get the info
>
> That would work, but Method Replacement [1] was added in Objective-C 2.0 as a replacement for "pose as class".  However, to do Method Replacement, you need to declare and implement a category on, in this case NSConcreteNotification, but that won't compile because NSConcreteNotification is Apple-private.  Does anyone know how to do Method Replacement for debugging in an Apple-private class?
>
> [1] http://developer.apple.com/mac/library/samplecode/MethodReplacement/index.html
>
_______________________________________________

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: Switching methods in private classes in Apple frameworks
      • From: Greg Parker <email@hidden>
References: 
 >How to debug this error on closing a document? (From: Gideon King <email@hidden>)
 >Re: How to debug this error on closing a document? (From: Kyle Sluder <email@hidden>)
 >Re: How to debug this error on closing a document? (From: Gideon King <email@hidden>)
 >Re: How to debug this error on closing a document? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Answer: Bison with Objective-C Semantic Actions? Works
  • Next by Date: Re: Switching methods in private classes in Apple frameworks
  • Previous by thread: Re: How to debug this error on closing a document?
  • Next by thread: Re: Switching methods in private classes in Apple frameworks
  • Index(es):
    • Date
    • Thread