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

554 questions
0
votes
1 answer

Split Data for NSKeyedArchiver and NSKeyedUnarchiver

Edit (2012/10/22): Restating this question in hopefully clearer terms. Essentially, what I'm looking for is some NSCoder that can (un)archive between multiple locations. Some of the encoded objects primitives should be saved in location A while…
Ncat
  • 407
  • 3
  • 10
0
votes
1 answer

Write Array to a file ArchiveRootObject

NSMutableArray *esami = [[NSMutableArray alloc] init]; NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; //make a file name…
Usi Usi
  • 2,857
  • 5
  • 29
  • 63
0
votes
0 answers

Converting a NSDictionary contents into NSData

I have an NSDictionary (which I get from querying in sqlite) which contains bytes. Here is a sample: Rects = "<62706c69 73743030 d4010203 04050824 25542474 6f705824 6f626a65 63747358 24766572 73696f6e 59246172 63686976... I want to convert this…
0
votes
1 answer

Changing Value of Objects property doesn't work for object created using NSKeyedUnarchiver

I am trying to Change the value of an Object's property (Unarchived from .plist) and it doesn't seem to work... I Am trying to figure out whats wrong for a while now and I would really appreciate any help. The Code: NSArray * pathArray =…
byteSlayer
  • 1,656
  • 5
  • 17
  • 36
0
votes
1 answer

Archiving on iOS using NSKeyedArchiver

I'd like my app to decompress and handle the contents of zip files. I'm trying to do this the Cocoa way, without using external libraries, so I'm turning to NSKeyedUnarchiver and here's my code: -(void) unarchive{ NSString *outputDirectory =…
Eric
  • 12,878
  • 13
  • 78
  • 119
0
votes
1 answer

Searching Functions in Objective C

I have a strange task. I need to get an array that contains all the functions in an objective c object. I then need to be able to tell if each function is a class method or not. Then I need to get the names (preferably an NSString) of each parameter…
Ben Trapani
  • 271
  • 1
  • 4
  • 11
0
votes
2 answers

Encoding NSAttributedString Throws Error

Based on the accepted answer to this question I wrote the following code: NSData* somedata; somedata=[NSKeyedArchiver archivedDataWithRootObject:ts]; where ts is an NSAttributedString that is populated with some text and some attributes (colors, in…
Chris
  • 982
  • 1
  • 14
  • 33
0
votes
1 answer

Objective-c - initWithCoder and memory management?

I'm getting a leak in initWithCoder method. Does unarchiveObjectWithData:cacheData return me an autoreleased object? whose responsible to release the object return from unarchiveObjectWithData:cacheData? @implementation MyObject @synthesize…
aryaxt
  • 69,636
  • 87
  • 281
  • 421
0
votes
2 answers

NSKeyedArchiver NOT writing Data to File...?

@interface @interface Patient : NSObject @implementation - (id)initWithCoder:(NSCoder *)decoder{ self.patientPhoto = [decoder decodeObjectForKey:kPatientPhoto]; self.firstName = [decoder decodeObjectForKey:kFirstName]; …
Michael
  • 5,793
  • 5
  • 32
  • 46
0
votes
2 answers

My NSMutableArray suddenly becomes a CALayer

I think I am hallucinating. I am trying to add some persistence to my Concentration-lke game. I would like to keep track of high scores. I got this partially working for a little while today and now it has all gone kablooie (I think that is the…
Augustus S-R
  • 67
  • 1
  • 8
0
votes
1 answer

how to NSKeyedUnarchiver with multiple chunk from bump?

encountered this problem i wanna sent images through bump, but bump api's max chunk is 256kb if([[NSKeyedArchiver archivedDataWithRootObject:self.selectedImg]length] > 262144) { int dlen = [[NSKeyedArchiver …
Desmond
  • 4,943
  • 14
  • 51
  • 112
0
votes
0 answers

Error archiving two arrays in objective-c

I'm going through the Beginning iOS 5 example and trying to tweak it for my usage. I have a DataManager singleton object that has properties of: @property (nonatomic, strong) NSArray *frequencyArray; @property (nonatomic, strong) NSMutableArray…
Crystal
  • 25,222
  • 53
  • 203
  • 370
-1
votes
1 answer

NSKeyedArchiver working in Simulator but not Device, iOS SDK

I tried to modify it a bit and looked at other options here and googled some stuff but nothing seems to work. here's what I have, like I said, It works perfectly in the simulator but not the device, witch runs iOS 5.x I thanks for all the help. …
franklinexpress
  • 1,079
  • 12
  • 42
-1
votes
2 answers

NSKeyedArchiver nil values in Dictcionary

I am trying to convert a Swift Dictionary to data using NSKeyedArchiver. My question is if the dictionary has some of the key values as nil, how is NSKeyedArchiver supposed to handle it? Does it convert nil object to something like NSNull, or will…
Deepak Sharma
  • 4,106
  • 3
  • 37
  • 84
-1
votes
1 answer

How to save objects with sub-classes using NSKeyedArchiver in Swift IOS

I'm just trying coding in Swift and I am trying to modify this existing project in the Apple Dev Library re: Meals. I was hoping to put in an additional subclass such as Ingredients into the main Meal class having it as an array or…
1 2 3
36
37