Search code examples
iosnsnull

iphone - [NSNull getCharacters:]:


I got the above in an error message.

[NSNull getCharacters:]:

I cannot find it in the documentation. Can someone explain to me what it means?

Many thanks.

Edit: This is a different one than the question than the one linked to which is about the use of NSNull getCharacters. This one just asks what it means.


Solution

  • Straight from Apple documentation: "The NSNull class defines a singleton object used to represent null values in collection objects (which don’t allow nil values)."

    From here on, it's pure speculation, as you've shown no code and no error message. If you push an object into a collection without checking it is not null, you'll be pushing NSNull. Then, if you have some kind of error or debugging, NSNull will call a private API getCharacters (which I'm guessing is private as there's no documentation). I suspect it is the equivalent of Java's toString() and is called when an error message is outputted.