Question

so i am getting a NSzombie and it says this

-[__NSArrayI _cfTypeID]: message sent to deallocated instance

Any idea what that is? assumably an array although i thought if it were an NS type it would say.

Was it helpful?

Solution 2

Basically that means your NSArray object is already deallocated. Something in Foundation.framework tried to access your NSArray's private method _cfTypeID and crashed.

And about question why there's _cfTypeID method in NSArray object. NSArray Core Foundation counterpart of CFArray. Two type's are interchangeable with "toll-free bridge". So actually apple uses that method for internal uses. If you want deeper understand of this. You can visit http://code.google.com/p/cocotron/source/browse/Foundation/NSArray/NSArray.m and this is Cocotron's implementation of NSArray. It is not same with the apple's implementation but still implementations are similar.

OTHER TIPS

Yes — that'll be some type of array. Rather than being single classes, most of the foundation types are class clusters. So exactly how you initialise the array affects exactly which subclass of NSArray you get back.

The exact behaviour is undocumented and basically guaranteed to change over time but for example if you created an immutable array with less than a certain number of entries then the system might decide to return a single linked array and perform searches as simple linear searches. If you create one above the threshold then it might instead create an array that adds some sort of hierarchical logic for searching (or, more likely, contains the logic to create suitable hierarchical tables if the user starts trying to search the array).

Related lessons to learn:

  • never try to subclass a foundation class;
  • don't expect isMemberOfClass: to work properly;
  • don't even expect isKindOfClass: necessarily to be able to tell immutable from mutable versions of the foundation classes.

Apple needs a way to differentiate these classes and to flag them as private, so you end up with underscores and suffixes. In practice I think __NSArrayI is a vanilla immutable array.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top