title: How to update NSKeyedUnarchiver unarchiveObjectWithData to NSKeyedUnarchiver unarchivedObjectOfClass:[fromData:error:
body: <p>My app currently uses this deprecated function:</p>
  
  <pre><code>id unarchivedObject=[NSKeyedUnarchiver unarchiveObjectWithData:codedData];
  if([unarchivedObject isKindOfClass:[NSDictionary class]]){
      // currently returns TRUE when reading existing user data.
  } 
  </code></pre>
  
  <p>To update, I've converted to this:</p>
  
  <pre><code>id unarchivedObject=[NSKeyedUnarchiver unarchivedObjectOfClass:[NSDictionary class] fromData:codedData error:nil];
  if([unarchivedObject isKindOfClass:[NSDictionary class]]){
      // currently returns FALSE when reading existing user data.
  }
  </code></pre>
  
  <p>The data was originally encoded like this:</p>
  
  <pre><code>-(void)encodeWithCoder:(NSCoder*)encoder{
      [encoder encodeObject:text forKey:@"text"];
  }
  -(instancetype)initWithCoder:(NSCoder*)decoder{
      if(self=[super init]){
          text=[decoder decodeObjectForKey:@"text"];
  }
  </code></pre>
  
  <p>What could be causing the IF statement to return FALSE using the newer code?</p>
  
  <p>Please note that I am concerned primarily with reading existing data stored prior to deprecating the Archiving functions. Simply changing to the newer functions does not resolve the issue.</p>