• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Newbie question on saving data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Newbie question on saving data
      • From: Scott Stevenson <email@hidden>
  • Prev by Date: Re: $10 for a few [hours?] work
  • Next by Date: Re: Newbie question on saving data
  • Previous by thread: Colored Rounded Box
  • Next by thread: Re: Newbie question on saving data
  • Index(es):
    • Date
    • Thread