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
1 answer

NSUserDefaults crashes with EXC_BAD_INSTRUCTION

My app is crashing with EXC_BAD_INSTRUCTION(code=EXC_i386_INVOP, subcode=0x0). The console logs (lldb). I'm trying to use NSUserDefaults with NSKeyedArchiver and NSKeyedUnarchiver. The class I'm trying to serialise is a subclass of NSManagedObject,…
0
votes
1 answer

Custom NSObject iniWithCoder not called

I have a custom object, LevelContent, which contains some properties. LevelContentconforms to NSCoding, and I have implemented encodeWithCoder: and initWithCoder: methods. I save and fetch the data to Parse.com. Saving works fine like this: NSData…
imas145
  • 1,959
  • 1
  • 23
  • 32
0
votes
1 answer

NSKeyedUnarchiver unarchiveObjectWithFile decodeBytesForKey EXC_BAD_ACCESS code=1 when retrieving data

I need a little help with decodeBytesForKey using NSKeyedUnarchiver unarchiveObjectWithFile. I appear to be writing everything correctly but reading the data gives me a EXC_BAD_ACCESS error. I'm trying to deserialize data and have gotten confused…
Patricia
  • 5,019
  • 14
  • 72
  • 152
0
votes
1 answer

NSKeyedUnarchiver SKSpriteNode not showing

My SKSpriteNode is not appearing in the view when I am restoring from a saved state. There are no errors or warnings during the save and restore process. I am saving my player class using this code: NSUserDefaults *defaults = [NSUserDefaults…
sangony
  • 11,636
  • 4
  • 39
  • 55
0
votes
0 answers

Wait until unarchiveObjectWithData method is done

I'm using archivedDataWithRootObject: / unarchiveObjectWithData: methods to serialize / deserialize a list of strings relative to images to load from the device in my app. So when unarchiveObjectWithData method is executed: [NSKeyedUnarchiver…
Jean Lebrument
  • 5,079
  • 8
  • 33
  • 67
0
votes
1 answer

Can not Archive and Unarchive file to Document Folder

This code does not give any error but it's not creating the "plist" file nor reading from it. I wrote a code that specifies the direct path to the folder and it creates and writes to the file although it cannot read from it. [NSKeyedArchiver…
0
votes
1 answer

Archiving Multiple Objects and Unarchiving them as array of objects in objective C

I am calling the function archiveQueue to store object of type MYJSON at various times through out the program, and now I want to restore everything that I stored uptill now in an array. Following is the function that I am using to store the objects…
Nilesh Agrawal
  • 3,002
  • 10
  • 26
  • 54
0
votes
1 answer

Issue with initWithCoder: and NSKeyedUnarchiver

I'm currently attempting to add a game-saving feature to my app. The end goal is to get ~300 custom objects saved to a .plist file and extract them again later. I've made some headway, but I'm having some issues with initWithCoder: and I'm also…
rebello95
  • 8,486
  • 5
  • 44
  • 65
0
votes
1 answer

NSKeyedArchiver would not save or load objects

So I have an array with some custom classes: NSMutableArray With Games (FirstViewcontroller) -Game with Dices (Game.m) -- Dices With Options (Dices.m) In each custom class i've setter the encode and decode up: -(void)encodeWithCoder:(NSCoder…
Kets
  • 438
  • 2
  • 8
  • 24
0
votes
2 answers

How to deal with unarchiver with this situation..?

I'm making simple program that can archive my object and unarchive it when launching. I have a lists.m where mutable array called favouritesList get store into file using archive. Inside list, i have simple object called favouriteItem So, the…
denis_choe
  • 667
  • 6
  • 15
0
votes
3 answers

How to archive an object in one View Controller and then unarchive it in another?

I have an object "School" with a mutable array property "favoritesArray" and an NSString property "name". I have 2 view controllers "HomeViewController" and "FavoritesTableViewController". In my HomeViewController when a button is tapped this…
0
votes
1 answer

Segue With NSUserDefaults + NSCoder Object

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { if ([[segue identifier] isEqualToString:@"ShowWordDetailsTwo"]) { NSIndexPath *indexPath = nil; Words *word = nil; indexPath = [self.tableView…
Mou某
  • 556
  • 3
  • 10
  • 32
0
votes
1 answer

NSKeyedArchiver Doesn't Seem Properly Save an MPMediaItemCollection Object

I am trying to save a playlist of songs created with the media picker. I tried to use the suggestion provided in Persist a MPMediaItemCollection Object Using NSUserDefaults. This solution uses NSKeyedArchiver as follows: NSData *data =…
0
votes
0 answers

Any chance to update a UIProgressView while NSKeyedUnarchiver?

in my app, I save arrays in core data with NSKeyedArchiver. Then, I use the following code when the data is needed (to feed Core Plot) : dispatch_queue_t backgroundQueue = dispatch_queue_create("com.mycompany.myqueue",…
jcr
  • 303
  • 1
  • 6
  • 16
0
votes
1 answer

EXC_BAD_ACCESS when using NSKeyedUnarchiver to load saved state

I have subclassed a CCSprite to make an object that can be encoded and decoded. I want to save sprites state and load it again at particular positions. Everything seems to be okay apart from decoding with NSKeyedUnarchiver (see loadIconSpriteState…
1 2 3
13
14