nskeyedarchiver

Encoding Large Object Graph Using NSKeyedArchiver Eats Memory

I'm using a NSKeyedArchiver to encode a big object graph (76295 objects.) It takes a lot of time but even worse the NSKeyedArchiver doesn't give back all its memory. After using the Leak check, the code doesn't appear to leak at all but for some reason the encoding doesn't give back all memory after it's done. Calling the encode method...

Archive a NSMutableArray

I need to archive a NSMutableArray which is being controlled by an ArrayController. I tried this: [NSKeyedArchiver archivedDataWithRootObject:array]; But I got this error: *** -[NSKeyedArchiver dealloc]: warning: NSKeyedArchiver deallocated without having had -finishEncoding called on it. How may I solve that please? ...

Why is my NSURLResponse leaking memory when archived?

I found a leak in my code where archiving and unarchiving an NSURLResponse was causing a leak, and I can't figure out why. - (void)doStuffWithResponse:(NSURLResponse *)response { NSMutableData *saveData = [[NSMutableData alloc] init]; NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:s...

iPhone NSKeyedArchiver - the data saved with this class persist after app update via AppStore?

Hello, I am a newbie in the iPhone dev and I want to know if I will save some data(NSSDictinary) with NSKeyedArchiver, tis data persist after an update process of my app via AppStore? Let's say that I want to save user an pass for my app and probably this information will be saved into the app folder.If I will update the app via AppStor...

What format does NSKeyedArchiver save?

When I use NSKeyedArchiver is the data that is written a *.plist, I have seen some examples where people have the output file down as *.txt or even without an extension at all? -(void)saveCore { NSMutableData *data = [[NSMutableData alloc] init]; NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:...

How to persist and load an object which conforms to NSCoding protocol?

I have made an class which conforms to the NSCoding protocol and does all the encode and decode stuff. For my app, I simply want to persist an object from that class to the device and the next time when the app launches, I want to load that object back into memory. Basically it's just an class which holds some user input information. F...

NSKeyedArchiver save method ( that i made) crashed the iphone simulator

i saw this approach on a tutorial, and the message is working for their example but when i implement this it does not work. from what i can tell the iphone simulator crashes when i do a [ self saveSettingsData]. TheSettings is class object that i declare and initialize in the appdelagate with these methods. the error says terminating due...

When saving something to disk with NSKeyedArchiver, where is that stored on the iPhone?

Example: If I used this, where does the iPhone store the file? if (![NSKeyedArchiver archiveRootObject:your_object toFile:@"filename.plist"]) // save failed. On my mac the filename.plist goes to Macintosh HD directly. No folder. Also, the NSKeyedArchiver doesn't seem to ask for a path, just for a file name. Strange or not? And how...

Cocoa: Cannot Archive Array of Values Representing CGPoints

Hey guys, I have converted CGPoint To NSValue and put all the resulting values in q NSArray but when i use [NSKeyedArchiver archiveRootObject:ArrayName toFile:PointArrayFile]; it gives me error. If some one know please do help me how can I achieve this ... Thanks Umer Sufyan ...

monotouch NSKeyedArchiver

Hey does anyone have any examples of using NSKeyedArchiver in monotouch? i just want to store a list of pocos w:// ...

UIImagePickerController Causes my app to crash!

In my app, a user can select an image, change the picture of a UIImageView to the new imge, and save the image to NSUserDefaults using NSKeyedArchiver. When the user selects the image and the - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info is called, the app immediately ...

Does NSKeyedUnarchiver autorelease?

I'm doing some archiving to a property list and when I unarchive my data using NSKeyedUnarchiver I find that my app crashes if I release the object afterward. I was wondering if the finishDecoding message also autoreleases the object. Seems weird that it crashes when I release it. ...

game state singleton cocos2d, initWithEncoder always returns null

Hi, I'm trying to write a basic test "game state" singleton in cocos2d, but for some reason upon loading the app, initWithCoder is never called. Any help would be much appreciated, thanks. Here's my singleton GameState.h: #import "cocos2d.h" @interface GameState : NSObject <NSCoding> { NSInteger level, score; Boolean seenInstruct...

NSKeyedArchiver to serialize to GPX XML

I have a Location class that contains a lat/lon as well as an elevation and timestamp: @interface Location : NSObject <NSCoding> { double lon; double lat; double ele; NSDate *time; NSDateFormatter *gpxDateFormatter; } I want to be able to serialize an NSMutableArray containing an arbitrary number of these Location objects into ...

NSKeyedArchiver and NSValue - How to Archive?

How do I archive an array of NSValues ? What conversions should I make to do this? It won't archive it as is. Code: [[NSUserDefaults standardUserDefaults] setObject:[NSKeyedArchiver archivedDataWithRootObject:[[NSArray alloc] initWithArray:drawingsArray]] forKey:@"NSValuesArray"]; Error: *** Terminating app due to uncaught exce...

NSKeyedArchiver / Unarchiver

Hi, I'm using NSKeyedArchiver to persist multiple objects in my application. The persistence is working fine, but I can't find a way to delete a specific object from the file. How do I delete this object programmatically? Thanks, Teja ...

NSKeyedUnarchiver chokes when trying to unarchive more than one object

We've got a custom matrix class, and we're attempting to archive and unarchive an NSArray containing four of them. The first seems to get unarchived fine (we can see that initWithCoder is called once), but then the program simply hangs, using 100% CPU. It doesn't continue or output any errors. These are the relevant methods from the matr...

NSKeyedArchiver on NSArray has large size overhead

I'm using NSKeyedArchiver in Mac OS X program which generates data for iPhone application. I found out that by default, resulting archives are much bigger than I expected. Example: NSMutableArray * ar = [NSMutableArray arrayWithCapacity:10]; for (int i = 0; i < 100000; i++) { NSString * s = [NSString stringWithFormat:@"item%06d", i...

NSKeyedUnarchiver - Bad access

Hi I was trying to archive an object into a plist file and load it later to fill a tableView. It seems that the file gets archived correctly but I get a bad access when trying to get the value out of the file. Am I doing something wrong? This is where I save it // Create some phonebook entries and store in array NSMutableArray *book ...

Fast (de)serialization on iPhone

I'm developing a game/engine for iPhone OS. It's the first time I'm using Objective-C. I made my own binary format for geometry data and for textures I'm focusing on PVRTC. That should be the optimal approach as far as speed and space are concerned. I really want to keep loading time to a minimum and - if possible - be able to save very...