title: -[MyClassName copyWithZone:] unrecognized selector sent to instance
body: <p>My application crashed with the reason:</p>
  
  <blockquote>
    <p>-[MyClassName copyWithZone:]  unrecognized selector sent to instance</p>
  </blockquote>
  
  <p>I have two classes. Let's say Class1 and Class2.</p>
  
  <p>Class1 looks like:</p>
  
  <h3>Class1.h</h3>
  
  <pre><code>@interface Class1 : NSObject {
      NSString *imagemd5CheckSum;
      UIImage *image;
      NSData *fileChunkData;
  }
  
  @property (nonatomic, copy)NSString *imagemd5CheckSum;
  @property (nonatomic, copy)UIImage *image;
  @property (nonatomic, copy)NSData *fileChunkData;
  
  @end
  </code></pre>
  
  <h3>Class1.m</h3>
  
  <pre><code>@implementation Class1
  
  @synthesize image;
  @synthesize fileChunkData;
  @synthesize imagemd5CheckSum;
  
  -(id) init{
      [self setImage:nil];
      [self setFileChunkData:nil];
      [self setImagemd5CheckSum:@""];
  
      return self;
  }
  
  -(void)dealloc{
      [imagemd5CheckSum release];
      [image release];
      [fileChunkData release];
  
      fileChunkData = nil;
      imagemd5CheckSum = nil;
      image = nil;
  
      [super dealloc];
  }
  @end
  </code></pre>
  
  <p>**</p>
  
  <blockquote>
    <p>Class2 looks like</p>
  </blockquote>
  
  <p>**</p>
  
  <h3>Class2.h</h3>
  
  <hr>
  
  <pre><code>#import "Class2.h"
  @interface Class2 : NSObject {
      Class1 *obj1;
      Class1 *obj2;
      Class1 *obj3;
  }
  
  @property (nonatomic, copy)Class1 *obj1;
  @property (nonatomic, copy)Class1 *obj2;
  @property (nonatomic, copy)Class1 *obj3;
  
  @end
  </code></pre>
  
  <h3>Class2.m</h3>
  
  <hr>
  
  <pre><code>@implementation Class2
  
  @synthesize obj1,obj2,obj3;
  
  -(id) init{
      [self setObj1:nil];
      [self setObj2:nil];
      [self setObj3:nil];
  
      return self;
  }
  
  -(void)dealloc{
      [obj1 release];
      [obj2 release];
      [obj3 release];
  
      obj1 = nil;
      obj2 = nil;
      obj3 = nil;
  
      [super dealloc];
  }
  @end
  </code></pre>
  
  <h3>Crashed Situation</h3>
  
  <pre><code>Class2 *class2 = [[Class2 alloc] init];
  
  Class1 *class1 = [[Class1 alloc] init];
  
  [class1 setImagemd5CheckSum:@"this is md5"];
  [class1 setImage:myimage];
  [class1 setFileChunkData:myData];
  
  [class2 setObj1:class1]; // This line is crashed..
  </code></pre>
  
  <p>...</p>
  
  <p>When I called <code>[class2 setObj1:class1];</code>, the application crashed with reason:</p>
  
  <blockquote>
    <p>-[Class1 copyWithZone:]  unrecognized selector sent to instance</p>
  </blockquote>
  
  <p>How can I fix this problem?</p>