title: How to use the delegates with NSKeyedUnarchiver?
body: <p>I am using NSKeyedUnarchiver to unarchive an object and would like to use the delegates (NSKeyedUnarchiverDelegate), but my delegates are not called. Archiving and Unarchiving is working fine, but the Delegates (unarchiver &amp; unarchiverDidFinish) are not called. Can someone help?</p>
  
  <p>I have the following implementation:</p>
  
  <pre><code>        class BlobHandler: NSObject , NSKeyedUnarchiverDelegate{
  
             func load() -&gt; MYOBJECTCLASS{          
                let data:NSData? = getBlob();      
                var mykeyedunarchiver:NSKeyedUnarchiver=NSKeyedUnarchiver(forReadingWithData: data!);
                mykeyedunarchiver.delegate = self;
                let temp=mykeyedunarchiver.decodeObjectForKey("rootobject")
  // No delegates are called
                              if temp==nil {
                                  blobsexists=false;
                              }else{
                                  objectreturn = temp! as! MYOBJECTCLASS;
                                  return objectreturn;
                              }
          }
  
      func save1(myobject:MYOBJECTCLASS){
              let data = NSMutableData()
              var keyedarchiver:NSKeyedArchiver=NSKeyedArchiver(forWritingWithMutableData: data);
              keyedarchiver.encodeObject(maptheme, forKey: "rootobject");
  
              let bytes = data.bytes;
              let len=data.length; 
              saveblob(bytes);
      }
  </code></pre>
  
  <p>The following delegates, which are also implemented in my Blobhandler, are never called:</p>
  
  <pre><code>func unarchiver(unarchiver: NSKeyedUnarchiver, cannotDecodeObjectOfClassName name: String, originalClasses classNames: [String]) -&gt; AnyClass? {
      print("I am in unarchiver !");
      return nil;
  }
  
  func unarchiverDidFinish(_ unarchiver: NSKeyedUnarchiver){
      print("I am in unarchiverDidFinish ! ");
  }
  </code></pre>