What is NSConcreteData, and where is it defined?

后端 未结 1 1670
情书的邮戳
情书的邮戳 2021-01-01 23:34

The following code:

[[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:mapURL]]

returns an instance of NSConcreteData as opposed to

相关标签:
1条回答
  • 2021-01-02 00:12

    The Foundation framework uses class clusters in certain areas to provide a common interface to various classes. What this means is that, when you use an NSData API to create an NSData object, the actual class that is instantiated and returned is different from NSData, but can and should be treated and referred to as an NSData object by your code.

    At the end of the day, the simple answer is: ignore the existence of NSConcreteData and treat it like NSData.

    For more information on class clusters, please see the Class Clusters section of Apple's Cocoa Fundamentals Guide.

    0 讨论(0)
提交回复
热议问题