Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the different between NSCFString and NSConstantString?

I declare the object variable as a NSString But when I use the XCode to look into my object, I saw there are two type of String, it seems that the system automatically transfer to another:

enter image description here

What are the different between them? Are they interchangeable to one and others. Also, what is the condition two change to another?

Thanks.

like image 620
DNB5brims Avatar asked Apr 19 '12 02:04

DNB5brims


1 Answers

They're both concrete subclasses of NSString. __NSCFString is one created during runtime via Foundation or Core Foundation, while __NSCFConstantString is either a CFSTR("...") constant or an @"..." constant, created at compile-time.

Their interfaces are private. Treat them both as NSString and you should have no trouble.

like image 169
Jonathan Grynspan Avatar answered Oct 05 '22 23:10

Jonathan Grynspan