nskeyedarchiver

Where'd my sounds go?

In my Row class I have the initWithCoder method and everything restored in that method works fine, but only within the method. After the method is called I loose an array of sounds that is in my Row class. The sounds class also has the initWithCoder method, and the sound plays fine but only in the Row class initWithCoder method. After de...

What happens with unarchived objects?

After I've unarchived an object with NSKeyedUnarchiver, I am able to use it like usual, but I am unable to re-archive it. When I try, it crashes. [NSKeyedArchiver archiveRootObject:unarchivedObject toFile:fileName]; I tried looking in the developer resources in apple but I haven't seen a thorough explination of proper usage of NSKeyed...

NSNumbers in archived array dissappear.

Okay I've made an array of NSNumber objects that I've stored into an NSMutableArray. When the game loads it's unarchived and retained but all the NSNumber objects are gone. Here's my code: times = [[NSMutableArray alloc] initWithObjects:[[NSNumber alloc] initWithFloat:time],nil]; [NSKeyedArchiver archiveRootObject:times toFile:@"times"]...

Error using NSKeyedUnarchiver

Hi I'm writing an iPhone app, and having problems trying to archive the settings. I am using a class (AppData) to hold settings (the example shows just one at present), and using the App Delegate to create an instance of AppData when the app loads, and store it when the app terminates. I am conforming (I think) to the NSCoding protoco...

NSKeyedUnarchiver - delete decoded data?

Hi, I couldn't get any replies on my previous (related) question, so I'm wondering if slightly paraphrasing it will be of any help. I'm encoding a few complex objects with NSKeyedArchiver and saving it to disk. Say, something like - Class member { int *id; NSString *name; NSMutableArray *array; TempClass *object; } ...

NSCoding with as NSString inside a object

My issue is then i retrive my NSArray of Store objects, all my NSString properties are giving me BadAccess errors. The int and double works fine! store.h @interface Store : NSObject<NSCoding> { NSString *Name; NSString *Address; NSString *Phone; double GeoLong; double GeoLat; int ID; } @property (nona...

How to archive an NSArray of custom objects to file in Objective-C

Hello, Can you show me the syntax or any sample programs to archive an NSArray of custom objects in Objective-C? ...

Data protection on mobile devices.

Hi, I'm storing some healthcare data on a mobile phone and I'd like to know what the best system of encryption is, to keep the data secure. It's basically a bunch of model objects, that I'm serializing and storing using NSKeyedArchiver / the equivalent on Blackberry (the name eludes me for now) Any tips? I don't want to make up securit...

How to save my own object with NSKeyedArchiver??

Hi, i've got problems using the NSKeyedArchiver/NSKeyedUnarchiver for saving my object. I added the methods - (id)initWithCoder:(NSCoder *)decoder and - (void)encodeWithCoder:(NSCoder *)encoder. The problem is when i try to save the object it doesn't work correctly. I could imagine a problem (but I'm not sure if it is the problem ;) ). ...

NSKeyedUnarchiver crashes after decoding an array

Hi, I have very frustrating problem. When I try to release NSKeyedUnarchiver object after decoding an NSArray, "EXC_BAD_ACCESS" error occurs. But when I don't release it or decode other object (e.g. NSString) everything go well. I don't understand it... For me, it looks like "decodeObjectForKey" method changes something in "decoder" obje...

Problems with the NSKeyedArchiver

Hi, i've still have got problems with the NSKeyedArchiver. I implemented everything I was told to do, but it still does not work. I'm kind of frustrated. So could anyone help me out? Here is the .h file: #import <Foundation/Foundation.h> #import "JFIdentifier.h" // This is my own class to create a unique identifier for every JKDataObj...

Location for archiving on iPhone

I'm looking to archive some nested NSDictionary objects to be able to use the data in them at next start. To do so I was going to use [NSKeyedArchiver archiveRootObject: toFile: ] but was not sure where to put the file. In the archiving docs, the examples put the file in NSTemporaryDirectory() but for persistent data, a temporary directo...

Can this code be used with an array of custom objects?

[[NSUserDefaults standardUserDefaults] setObject:myArray forKey:@"myArray"]; If I make an array of custom objects conform to the NSCoding protocol, then does the above work? Do I have to make both the custom class and the view controller that holds the array of custom objects conform to the NSCoding protocol or just the custom class? D...

How do I load this array into memory

I saved an array using the following code: NSData *data = [NSKeyedArchiver archivedDataWithRootObject:myArray]; [[NSUserDefaults standardUserDefaults] setObject:data forKey:@"myArray"]; What is the code to load it back into memory? ...

NSArchiver vs. NSKeyedArchiver

How do you know if you need to use NSArchiver or NSKeyedArchiver? What's the difference? ...

Do I need to use NSKeyedArchiver?

I have an object. It has only two NSStrings as properties. I created an array to hold several of these objects. Do I need to use NSKeyedArchiver to save this array to disk, or can I just use NSUserDefaults? ...

NSKeyedArchiver archivedDataWithRootObject:

Is the parameter for NSKeyedArchiver archivedDataWithRootObject: supposed to be the array I am trying to save, or the array converted into NSData? ...

encodeWithCoder Not getting called

I have an object (testSession) that complies to NSCoder and when I use: [NSKeyedArchiver archiveRootObject:testSession toFile:filename]; It has: @interface Session : NSObject <NSCoding> { and has encodeWithCoder: and initWithCoder: functions. Neither are getting called. What would prevent this? - (void)encodeWithCoder:(NSCoder *)e...

Default Directory of NSKeyedArchiver

I'm using NSKeyedArchiver to save an object. I didn't write out a full path in the path argument so my file is being written somewhere in the Apple iPhone simulator. What directory is my file going to? [NSKeyedArchiver archiveRootObject:self toFile:@"Vanilla"]; Thanks! mj ...

Saving NSMutableArray to NSUserDefaults using NSKeyedArchiver

Hi, I'm having trouble retrieving a saved NSMutableArray containing a custom object. The app crashes and the console reports http://pastie.org/1226822. Here is my objects .h file http://pastie.org/1226823. Here is my objects .m file http://pastie.org/1226826. Here is how I save my data http://pastie.org/1226830. Here is how I retrieve my...