Newbie question on saving data
Newbie question on saving data
- Subject: Newbie question on saving data
- From: Steve Gran <email@hidden>
- Date: Mon, 8 Nov 2004 16:31:09 -0800
I'm new to Cocoa and new to programming so excuse what maybe a simple question, but I haven't been able to figured it out in any of my books or online documentation.
I've implemented saving and loading as documented in Hillegass' book Cocoa Programming For Mac OS X as follows:
- (NSData *)dataRepresentationOfType:(NSString *)aType
{
//Stop editing
[playerController commitEditing];
//Now create an NSData Object from the players array
return [NSKeyedArchiver archivedDataWithRootObject:players];
}
- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
{
NSLog(@"About to read data of type %@, aType");
NSMutableArray *newPlayersArray;
newPlayersArray = [NSKeyedUnarchiver unarchiveObjectWithData:data];
if (newPlayersArray == nil)
{
return NO;
}
else
{
[self setPlayers:newPlayersArray];
return YES;
}
}
It works fine and saves and loads the data great. But...
What I want to have is the data saved in XML or just plain ASCII so that I can import it to Excel and edit the data prior to being reloaded in my app. If this matters, the array "players" contains various NSStrings and some int variables.
Thanks,
Steve _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden