I have an iOS 7 application that saves a custom object to app\'s iCloud Docs folder as a file. For this, I make use of NSCoding protocol.
@interface Person : NSO
Here's a Swift translation for Ferran Maylinch's answer above.
Had a similar problem in a Swift project after I duplicated the original target in order to have 2 builds of my product. The 2 builds needed to be useable interchangeably.
So, I had something like myapp_light.app and my app_pro.app. Setting the class fixed this issue.
NSKeyedUnarchiver.setClass(MyClass1.classForKeyedUnarchiver(), forClassName: "myapp_light.MyClass1")
NSKeyedUnarchiver.setClass(MyClass1.classForKeyedUnarchiver(), forClassName: "myapp_pro.MyClass1")
if let object:AnyObject = NSKeyedUnarchiver.unarchiveObjectWithFile("\path\...") {
var myobject = object as! Dictionary
//-- other stuff here
}