What is the different between NSCFString and NSConstantString?

前端 未结 4 577
迷失自我
迷失自我 2020-12-17 18:19

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 automa

4条回答
  •  误落风尘
    2020-12-17 18:52

    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.

提交回复
热议问题