<decode: bad range for [%{public}s] got [offs:294 len:935 within:0]>

Suggestions on what is causing this? Where to look? Could it be related to having a CoreData 'abstract entity' that occurs in two configurations - one configuration for 'public' and one for 'private/shared'?

I got this error. It appears in my case that an array I was using to populate views with a ForEach loop increased in size over time and began to include duplicates. When I removed the duplicates from the array, these errors stopped.

I have seen this error when switching away from unarchiveTopLevelObjectWithData (data) to secure coding for a nested object graph.

In my case the useful information came before this, because it listed types which I haven't included in my list of valid classes, like NSNumber, NSString, etc…

let classes: [AnyClass] = [KBGObject.self, KBGPath.self, KBGRect.self, KBGText.self, NSString.self, NSNumber.self, NSArray.self, NSDictionary.self, NSData.self]

let decodedChilds = coder.decodeObject(of: classes, forKey: CodingKeys.childs.rawValue) as? [KBGObject]

Hope it helps

Klaus

&lt;decode: bad range for [%{public}s] got [offs:294 len:935 within:0]&gt;
 
 
Q