Decoding a string with decodeObjectOfClass in Xcode 7 beta1 ?

Hi all,


How are you supposed to call decodeObjectForClass to get a String, in Swift 2 ? Currently with Xcode 7 beta 1, I can get the call to compile. I try


attr1 = aDecoder.decodeObjectOfClass(String.self, forKey: "attr1")


which fails with


Cannot invoke 'decodeObjectOfClass' with an argument list of type '(String.Type, forKey: String)'


fair enough, String is a struct, so let's try NSString :


attr = aDecoder.decodeObjectOfClass(NSString.self, forKey: "attr")


but that fails with


Missing argument for parameter 'error' in call


which is really weird. Do I log a radar ?


Thanks

Are you using a decoder/objects with NSSecureCoding?


If not, you should be able to just use the regular form:

func decodeObjectForKey(key: String) -> AnyObject?

Yes, they are using NSSecureCoding (it is required for XPC).

Decoding a string with decodeObjectOfClass in Xcode 7 beta1 ?
 
 
Q