title: NSUserDefaults encodeWithCoder unrecognized selector sent to instance
body: <p>I want to save <code>NSMutableDictionary</code> to <code>NSUserDefaults</code> then get error: </p>
  
  <blockquote>
    <p>NSUserDefaults encodeWithCoder  unrecognized selector sent to instance.
    Fatal Exception: NSInvalidArgumentException   [NSUserDefaults encodeWithCoder:]: unrecognized selector sent to instance 0x17544a080  </p>
  </blockquote>
  
  <p>Here is my code:</p>
  
  <pre><code>NSUserDefaults *shared2 = [[NSUserDefaults alloc]initWithSuiteName:@"AppGroupName"];
  NSMutableData *data1 = [[NSMutableData alloc]init];
  NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc]initForWritingWithMutableData:data1];
  [archiver encodeObject:shareDic forKey: @"shareDic"];
  [archiver finishEncoding];
  
  if (data1 !=nil)
  {
      [shared2 setObject:data1 forKey:@"dicFitnessData"];
  }
  </code></pre>