Questions tagged [nskeyedarchiver]

NSKeyedArchiver, a concrete subclass of NSCoder, provides a way to encode objects (and scalar values) into an architecture-independent format that can be stored in a file. When you archive a set of objects, the class information and instance variables for each object are written to the archive. NSKeyedArchiver’s companion class, NSKeyedUnarchiver, decodes the data in an archive and creates a set of objects equivalent to the original set.

NSKeyedArchiver, a concrete subclass of NSCoder, provides a way to encode objects (and scalar values) into an architecture-independent format that can be stored in a file. When you archive a set of objects, the class information and instance variables for each object are written to the archive. NSKeyedArchiver’s companion class, NSKeyedUnarchiver, decodes the data in an archive and creates a set of objects equivalent to the original set.

A keyed archive differs from a non-keyed archive in that all the objects and values encoded into the archive are given names, or keys. When decoding a non-keyed archive, values have to be decoded in the same order in which they were encoded. When decoding a keyed archive, because values are requested by name, values can be decoded out of sequence or not at all. Keyed archives, therefore, provide better support for forward and backward compatibility.

Click Here for class reference

570 questions
0
votes
1 answer

How to Retrive and Store NSArray from sqlite DB in iOS

I have an array itemQtyArray which i am storing in SQLITE table As: NSData *toData = [NSKeyedArchiver archivedDataWithRootObject:self.itemQtyArray]; NSString *insertSQL = [NSString stringWithFormat: @"INSERT INTO…
Sulabh
  • 11
  • 2
  • 6
0
votes
1 answer

MonoTouch NSKeyedUnarchiver

looking for help with NSKeyedUnarchiver in Monotouch Storying an Array of Dictionary items in an SQLite blob field IOS Code NSData *data = [[NSData alloc] initWithBytes:ptr length:size]; NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver…
NewDev
  • 257
  • 1
  • 5
  • 18
0
votes
2 answers

Struct to NSData between Mac and iOS

I have been working on this problem for a while, I have an app running on the mac, it has co-ordinate data stored in a struct like this: struct xyz { float x; float y; float z; }; struct xy { float x; float y; }; struct object { struct…
Darren
  • 269
  • 3
  • 8
0
votes
1 answer

iOS - Saving xml data after parsing

This question can be a duplicated one. But I was unable to find a proper answer for my issue. I have following xml file downloading from a server. Type1
Chinthaka
  • 966
  • 1
  • 13
  • 42
0
votes
2 answers

NSCoding -decoder returns wrong values -iOS

I have written the following method to encode/decode data.. - (void) encode: (BOOL) encodeBool int: (NSNumber *) integer boolean:(BOOL) boolean key: (NSString *) keyStr { NSArray *paths =…
user1526474
  • 925
  • 13
  • 26
0
votes
1 answer

Can't send bitmap over Bonjour

I send over an NSMutableArray via Bonjour - (void)sendArtwork { NSMutableArray *dataArray = [[NSMutableArray alloc] init]; NSData *imageData = [self PNGRepresentationOfImage:[bHelp getArtwork:[playerPref selectedRow]]]; [dataArray…
vqdave
  • 2,361
  • 1
  • 18
  • 36
0
votes
1 answer

Errors with Archiving / Unarchiving NSMutableDictionary

In my application, I have a dictionary called matchDataDictionary and I set the following: [[GCTurnBasedMatchHelper sharedInstance].matchDataDictionary setObject:deck forKey:@"deck"]; where deck is an instance of Deck:…
Nader Hendawi
  • 375
  • 1
  • 7
  • 17
0
votes
0 answers

iOS NSKeyedArchiver -- NSMutableDictionary coming back as NSPlaceholderDictionary?

I have a large and complex object graph. I have implemented NSCoding to archive and unarchive the object graph. Normally, everything works fine. But under certain highly reproducible circumstances, an NSMutableDictionary that I archive gets…
William Jockusch
  • 26,513
  • 49
  • 182
  • 323
0
votes
1 answer

App store submission with Archived Objects

So, for my project I created a utility app in which I used NSKeyedArchiver to store the data into this archive file. When I submit to the appstore, does it need to contain the code for how the archive was made or is just the archive fine? More…
Nadeem
  • 128
  • 1
  • 6
0
votes
1 answer

iOS - How to Save to and Read from file using Archiving?

I'am new to Xcode and I really need help on this. I'm trying to use Archiving to save a file with an array of items and trying to read and put them in a table view. The problem is that when I close the app and then launch it again, when I save the…
Joaocdn
  • 247
  • 2
  • 5
  • 9
0
votes
1 answer

Saving & deleting saved objects IOS

I have a fairly simple class that represents a game being created by a player for another player, before they game is sent to the other player by the server I would like to implement a sort of persistence in case something goes wrong i.e a crash. So…
Genhain
  • 1,937
  • 1
  • 19
  • 38
0
votes
1 answer

Versioning a persistent keyed archive?

For my current app I'm using the NSKeyedArchiver approach to persist my objects to the iPhone between launches. I'm wondering if it makes sense to tag this file when it's created with a version number so that in the future when the app revs we'll…
Meltemi
  • 37,979
  • 50
  • 195
  • 293
0
votes
1 answer

Key not found in an NSKeyedUnarchiver object

I usually encode my data in a NSFileWrapper like this (I leave out the NSFileWrapper bit): -(NSData*)encodeObject:(id)o { @autoreleasepool { NSMutableData *data = [NSMutableData data]; …
n.evermind
  • 11,944
  • 19
  • 78
  • 122
0
votes
1 answer

Crash after checking if NSDictionary can be archived

I have the following code to create an NSDictionary and then check if all of its values (and itself) are nil or not when being archived: NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; NSString *openbook = [defaults…
James Anderson
  • 556
  • 3
  • 16
  • 41
0
votes
1 answer

NSKeyedArchiver with NSMutableArrays and OData Objects causing Memory Leaks

I have a memory leak problem using OData where data retrieved from the OData web service is returned in an NSMutableArray, i.e. return [response getResult], and then stored using NSKeyedArchiver as follows: QueryOperationResponse *response =…