• 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
Encoding/Decoding Multiple Objects in MyDocument
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Encoding/Decoding Multiple Objects in MyDocument


  • Subject: Encoding/Decoding Multiple Objects in MyDocument
  • From: Jason Barker <email@hidden>
  • Date: Thu, 27 Apr 2006 13:15:13 -0600

Newbie question:

I have a subclass of NSDocument (MyDocument) that has two mutable arrays (array1 and array2) of objects. This is what I have for my archiving and unarchiving methods:


- (NSData *)dataRepresentationOfType:(NSString *)aType { return [NSKeyedArchiver archivedDataWithRootObject:array1]; }


- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType { NSMutableArray *newArray; newArray = [NSKeyedUnarchiver unarchiveObjectWithData:data];

  if(newArray == nil) {
    return NO;
  } else {
    [self setArray1:newArray];
    return YES;
  }
}

How do I set this up to archive and unarchive both arrays?


Thanks, Jason _______________________________________________ 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: Encoding/Decoding Multiple Objects in MyDocument
      • From: Ondra Cada <email@hidden>
  • Prev by Date: Re: NSNumberFormatter and localized format problem
  • Next by Date: Re: Getting a table to resize columns. I'm doing everything right but it's not working?
  • Previous by thread: Re: Standard authentication interface
  • Next by thread: Re: Encoding/Decoding Multiple Objects in MyDocument
  • Index(es):
    • Date
    • Thread