Questions tagged [nskeyedunarchiver]

NSKeyedUnarchiver, a concrete subclass of NSCoder, defines methods for decoding a set of named objects (and scalar values) from a keyed archive. Such archives are produced by instances of the NSKeyedArchiver class.

NSKeyedUnarchiver, a concrete subclass of NSCoder, defines methods for decoding a set of named objects (and scalar values) from a keyed archive. Such archives are produced by instances of the NSKeyedArchiver class.

A keyed archive is encoded as a hierarchy of objects. Each object in the hierarchy serves as a namespace into which other objects are encoded. The objects available for decoding are restricted to those that were encoded within the immediate scope of a particular object. Objects encoded elsewhere in the hierarchy, whether higher than, lower than, or parallel to this particular object, are not accessible. In this way, the keys used by a particular object to encode its instance variables need to be unique only within the scope of that object.

Click Here for class reference.

203 questions
0
votes
0 answers

TableView row duplication with NSKeyedArchiver

i am using NSKeyedArchiver to store a mutableArray after i click at the alertView button case 1: [self.playlistsNames addObject:[[alertView textFieldAtIndex:0]text]]; [NSKeyedArchiver archiveRootObject:self.playlistsNames…
chandal
  • 67
  • 4
0
votes
1 answer

Keeping data on screen when switching views with nskeyedarchiver

I have been using xcode for ~9 months now and I am close to finishing my app but have 1 small problem... A little bit of background. I have a button that randomly spits out some data [workouts in this case]. In that window there is also a button to…
-1
votes
1 answer

How to replace NSKeyedUnarchiver.unarchiveTopLevelObjectWithData with unarchivedObject when data is an array of Strings?

My project recently shows this error in Xcode: 'unarchiveTopLevelObjectWithData' was deprecated in macOS 10.14: Use unarchivedObject(ofClass:from:) instead I found this article which speaks to my exact problem: How to replace…
atoss
  • 73
  • 5
-1
votes
1 answer

How to archive and unarchive an SKPhysicsBody array using UserDefaults since iOS 12.0

I can successfully archive and unarchive an array of SKPhysicsBody's using UserDefaults as below but the unarchive process has been deprecated. This is the warning message... 'unarchiveObject(with:)' was deprecated in iOS 12.0: Use…
-1
votes
1 answer

Xcode 13 Warning - [NSKeyedUnarchiver validateAllowedClass:forKey:]

I am using File Storage system for saving some data models confirming to Codable Protocol. My Save function is as below: func save(value: T, for key: String, on path: URL) throws { let url = path.appendingPathComponent(key,…
the monk
  • 389
  • 4
  • 14
-1
votes
1 answer

Archiving, unarchiving and cleaning objects in cache with Swift

I have problems in handling the persistence of some classes in the cache. This is the code I tried and that does not work at all either recovering the archived data or deleting it: func cacheDirectoryURL()->NSURL?{ let…
-1
votes
4 answers

NSUserDefaults is saving just last value

I have a problem if anyone can help me or can give me an advice whose who faced with similar problem. Ok, I save data in NSUsersDefaults like this NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSData *data = [NSKeyedArchiver…
-2
votes
1 answer

Assigning unarchived object to a different object works, why/how?

Assigning an archived dictionary object but unarchived and assigned to an array does not seem to produce an exception and the logged out data from the array is that of the dictionary and not in array format at all if it was possible to assign to a…
1 2 3
13
14