Ask A Question
0

error: no visible @interface for 'NSObject' declares the selector 'copyWithZone:'

Asked by Howard Spear on 11/29/2012 at 12:22 AM

I want to allow deep copy of my class object and am trying to implement copyWithZone but the call to [super copyWithZone:zone] yields the error:

error: no visible @interface for 'NSObject' declares the selector 'copyWithZone:'

@interface MyCustomClass : NSObject

@end

@implementation MyCustomClass

- (id)copyWithZone:(NSZone *)zone
{
    // The following produces an error
    MyCustomClass *result = [super copyWithZone:zone];

    // copying data
    return result;
}
@end

How should I create a deep copy of this class?

View Full Answer On Stackoverflow

Responses

No responses yet. Be the first one!

    [Some content on this page is from Stackoverflow]