What is the different between NSCFString and NSConstantString?

前端 未结 4 576
迷失自我
迷失自我 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:55

    It appears to be an optimization done by the compiler. I'm guessing that the string that is getting converted to an NSCFConstantString is equal to one of the constants that is cached for performance reasons. Your NSCFString is just a toll-free bridged string that can be an NSString or a CFString. See this article for more information.

提交回复
热议问题