I think I might have just been rejected by Apple because of a bit of code in KissXML

76 views
Skip to first unread message

MattW

unread,
Nov 12, 2009, 12:06:02 AM11/12/09
to KissXML
Among other "illegal" APIs that their scanner had turned up, I got the
fairly cryptic "_NSObject instance variable" as one of the offenders.

A bit of googling seems to suggest that this is a name for the isa
pointer, which KissXML sets in initWithCheckedPrimitive in the file
DDXMLNode.m.

I suspect Apple may not relish the idea of assigning the isa pointer
to a class object other than the one that the runtime initialized. It
is a pretty low-level way to change a class' apparent type in the
runtime, although I think it is, in this case, correct.

Anyone else hit this?

Matt

Jon Gabilondo

unread,
Nov 13, 2009, 1:40:54 AM11/13/09
to kis...@googlegroups.com
Hi Matt,

Interesting .. rejected from AppStore you mean ?
No one else with the same problem ?
No one has an App with KissXML on AppStore ?
Is it a recent blocking they are doing ?

Cheers.

Matt Woodward

unread,
Nov 13, 2009, 11:03:33 AM11/13/09
to kis...@googlegroups.com
Since I submitted my last app, they've started using a tool that turns up all of the unauthorized APIs. I had used a few as shortcuts and to help polish the app, so there were a few things they flagged. Apple is within their rights, according to the contract I signed, to ask me to make this change, so I'm going to do it.

The mystery to me was '_NSObject instance variable' because I knew that I personally hadn't been doing anything low-level with NSObject, at least that I remembered.

*If* this is really the issue, then I suspect that KissXML users whose binaries get scanned by Apple will have the same issue. Since I can't tell you when they started using the scanner, I can't really assess how probable it is that I'm the first to submit with KissXML since the changes. I'm sure I'm not the only person using KissXML in the app store.

The one thing that I know, is that from searching and reading the code, this is the only bit of code in my app that I can find that gets down and dirty with NSObject instance variables.

I've fixed the things that I wrote, removed KissXML (it was pulled in by httpriot and I'm only using JSON in this app) and resubmitted. Unfortunately the only thing that this exercise will definitively prove is that, if the app is accepted, I did something to fix the concern.

So, if anyone on the list is submitting now, or has submitted since late Oct, I'd be really interested to hear if you go through. Mostly because I know that if this doesn't fix it, I've go some serious searching to do for something that isn't very clearly explained and I wouldn't mind a head start. If it is KissXML, getting KissXML updated to be Apple-safe is important to everyone's productivity beyond.

Matt

digidigo

unread,
Dec 8, 2009, 6:14:08 PM12/8/09
to KissXML
I am considering using KissXML as a part of HTTPRiot. I really like
the code that turns XML into a NSDictionary.

Anyone have any more thoughts on whether it has a chance to be
rejected? Is anyone working on removing the offending pieces?

Thanks in advance.

Dave

Luke Steffen

unread,
Dec 9, 2009, 1:09:24 AM12/9/09
to kis...@googlegroups.com
Hi Dave,

A few days after this post another individual posted that their app uses KissXML and was accepted to the App Store. Therefore, at this point we have no reason to believe an application will get rejected for using KissXML.

Luke Steffen
LukeS...@deusty.com
> --
>
> You received this message because you are subscribed to the Google Groups "KissXML" group.
> To post to this group, send email to kis...@googlegroups.com.
> To unsubscribe from this group, send email to kissxml+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/kissxml?hl=en.
>
>

David Clements

unread,
Dec 9, 2009, 9:02:54 AM12/9/09
to kis...@googlegroups.com, kis...@googlegroups.com
What do you think of the use of the ISA pointer? Do you think that is
private?

iDave

On Dec 8, 2009, at 11:09 PM, Luke Steffen <lukes...@deusty.com>
wrote:

Robbie Hanson

unread,
Jan 8, 2010, 11:24:51 AM1/8/10
to kis...@googlegroups.com
I'd like to preface this post by saying that I've "fixed" this "problem" in revision #23. The library no longer manipulates the ISA pointer, so big brother should be cool with it.

Now to answer the question at hand.

It's hard to say if the ISA pointer is technically private. It is a part of the Objective-C runtime, and is therefore heavily documented. Many references to it can be found in the "Objective-C Runtime Reference":
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html

The technique of changing the ISA pointer is called "isa-swizzling". In fact, I wrote a blog post about it here:
http://deusty.blogspot.com/2008/05/casting-subclassing-and-isa-field.html

As far as documentation from Apple is concerned, they make references to the ISA pointer in documentation on Key-Value Observing:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/KeyValueObserving/Concepts/KVOImplementation.html

They point out that they use isa-swizzling themselves:
"When an observer is registered for an attribute of an object the isa pointer of the observed object is modified, pointing to an intermediate class rather than at the true class."

And the guidance they offer on the topic is simply not to use the ISA value for obtaining the class of an object:
"Instead of relying on the isa pointer your application should use the class method to determine the class of an object instance."

However, much of this is a mute point, because with Objective-C 2.0 Apple added a method to change the class of an object:
object_setClass(id object, Class cls)

It is documented here:
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html#jumpTo_77

This method does the isa-swizzling for us, without us having to directly access the pointer.

So how did I fix the problem? Did I switch to the "object_setClass" method?

Actually, No.

I decided I could make the library a bit faster if I was more explicit about what types of objects I was creating, instead of depending on isa-swizzling. So I went through each place in the code that creates a new object, and verified it was creating the right type (DDXMLDocument vs DDXMLElement vs DDXMLNode). If I couldn't be absolutely sure what type, I used a new method that performs the proper checks prior to object allocation. In addition, I removed a bunch of duplicate checks for NULL.

I believe the end result should be a faster xml library.

Please report any issues you have with the library to the mailing list or to the Google Code Issue Tracker.

-Robbie Hanson
-Deusty Designs

David Clements

unread,
Jan 8, 2010, 1:11:37 PM1/8/10
to kis...@googlegroups.com
Great thanks for the info. 

Luckily I ended up getting the backend to move to JSON over REST!

I am really interested in learning more about changing the class of an object at runtime,  i'll have to read more about that.

Thanks,

Dave
--

Dave

Cell:303-618-7481
Email: da...@gidigo.com
Apps: http://bit.ly/gidigo
Web: http://www.gidigo.com
Blog: http://shortpath.blogspot.com

Matt Woodward

unread,
Jan 9, 2010, 11:46:15 AM1/9/10
to kis...@googlegroups.com
Thanks Robbie.

I think it shouldn't remain unsaid that there's a lot of people who appreciate this code, including me and that there's a KissXML donation button on this page: http://code.google.com/p/kissxml/.

I agree that this is a gray area, if that. I just wish we could understand what Apple was/is thinking on this one and if they truly relaxed the checker when Aleksei submitted, or if there are inconsistent errors or... The only thing I can say with any certainty is what happened, what I changed, and the conclusion I drew from it.

Thanks for addressing this.

Matt

Robbie Hanson

unread,
Jan 9, 2010, 12:41:29 PM1/9/10
to kis...@googlegroups.com
> I just wish we could understand what Apple was/is thinking on this one and if they truly relaxed the checker when Aleksei submitted, or if there are inconsistent errors or...

Well said. A little more communication from them would go a long way.

> Thanks for addressing this.

As a rule of thumb, when we hear users/developers having issues with our software/code, we assume that they're not the only ones. It's often the case that if several people are experiencing problems, only one of them will speak up. So thank you very much for reporting this issue to us.

-Robbie Hanson
-Deusty Designs

Justin Palmer

unread,
Jan 9, 2010, 1:54:26 PM1/9/10
to KissXML
Thanks for addressing this Robbie. It's difficult to play the game
when you don't have the rules and the rules you discern aren't
consistently applied. On the bright side, you managed to squeeze some
more speed out of the library.

If you're using KissXML as part of HTTPRiot, I'll have a new version
up this weekend.

-Justin

Reply all
Reply to author
Forward
0 new messages