• 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: WTF is happening?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WTF is happening?


  • Subject: Re: WTF is happening?
  • From: "Gary L. Wade" <email@hidden>
  • Date: Sat, 13 Dec 2014 11:34:19 -0800

If all you care about is if an object is a proxy or not, look at isProxy.
--
Gary L. Wade (Sent from my iPad)
http://www.garywade.com/

> On Dec 13, 2014, at 11:06 AM, Maxthon Chan <email@hidden> wrote:
>
> What I am doing here is scanning all loaded classes for subclasses of a certain class. Before any NSObject method can be issued I have to check if it is actually NSObject or NSProxy derivative instead of an Object derivative that does not support NSObject methods. This calls for runtime equivalent for one of the following NSObject methods:
>
> - [NSObject respondsToSelector:(SEL)aSelector] = class_respondsToSelector(Class, SEL) // this crashed.
> + [NSObject conformsToProtocol:(Protocol *)aProtocol] = class_conformsToProtocol(Class, Protocol *) // check for NSObject protocol, this does not work.
> + [NSObject isSubclassOfClass:(Class)aClass] // no equivalent, have to implement it myself
>
> I ended up creating this:
>
> BOOL class_isSubclassOfClass(Class cls, Class other)
> {
>    for (Class c = cls; c; c = class_getSuperclass(c))
>        if (c == other)
>            return YES;
>    return NO;
> }
>
> If i remembered it right GNUstep runtime have this function. I will file a bug report to Apple and ask them to add this, as it is useful in class scanning and i am using this technique heavily in jailbreak detection.
>
>> On Dec 14, 2014, at 01:20, Kyle Sluder <email@hidden> wrote:
>>
>> On Sat, Dec 13, 2014, at 10:19 AM, Phillip Mills wrote:
>>> Why do you think the problem is with “respondsToSelector:”?  The error
>>> says you’re accessing past the end of a string.
>>
>> Because the crash happens in a call stack that originates in
>> class_respondsToSelector, and involves none of Maxthon's code.
>>
>> --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: 
 >Re: WTF is happening? (From: Phillip Mills <email@hidden>)
 >Re: WTF is happening? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: WTF is happening?
  • Next by Date: Re: WTF is happening?
  • Previous by thread: Re: WTF is happening?
  • Next by thread: Re: WTF is happening?
  • Index(es):
    • Date
    • Thread