Why zone is always nil while implementing NSCopying?

前端 未结 5 1408
慢半拍i
慢半拍i 2021-02-13 04:47

It may be simple question, but why implementing NSCopying protocol in my class, I get zone == nil

- (id)copyWithZone:(NSZone *)zone
{
    if (zo         


        
5条回答
  •  北荒
    北荒 (楼主)
    2021-02-13 05:25

    NSZone is now an undocumented class because it is quite old, its purpose was to allocate objects on the heap using the same set of virtual memory pages. However it is mostly not used anymore, but since it was used before, that parameter is still there for backwards compatibility.

提交回复
热议问题