• 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
Re: Using NSPropertyListSerialization with NSArray of NSDictionaries
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using NSPropertyListSerialization with NSArray of NSDictionaries


  • Subject: Re: Using NSPropertyListSerialization with NSArray of NSDictionaries
  • From: Rick Hoge <email@hidden>
  • Date: Wed, 4 May 2005 11:57:45 -0400


Ok I found my inevitable dumb mistake in this - could be helpful to someone out there...


The dictionaries I was trying to serialize used to include the return value of [myDocument fileName] to record some provenance information. After seeing that fileName is slated for deprecation in favor of fileURL under the Tiger docs, I dutifully changed fileName to fileURL in a number of places. The problem is that, while fileName returns an NSString (which can be serialized), fileURL returns an NSURL (which can't). Changing things to get rid of the NSURL in the dictionary solved the problem.

Rick

On May 2, 2005, at 4:25 PM, Rick Hoge wrote:


It would be very useful for us to store an ordered array of dictionaries using NSPropertyListSerialization. The code below works fine if processingInfo is an NSDictionary, but fails with the message "Property list invalid for format" if processingInfo is an array of dictionaries.


Is there any other reasonable way to do this? The docs say that as long is everything is an array, dictionary, number, string, or date it should work. Should I file a bug?

Thanks for any hints,

Rick

if (processingInfo) {

xmlData = [NSPropertyListSerialization dataFromPropertyList: [processingInfo objectAtIndex:0]
format:NSPropertyListXMLFormat_v1_0
errorDescription:&error];
if (xmlData) {
char *str = malloc([xmlData length]+1); // Add trailing '\0'
memcpy(str,[xmlData bytes],[xmlData length]);
str[[xmlData length]] = '\0';
miattputstr(mincid, varid, "processingInfo", str);
free(str);
} else {
NSLog(error);
[error release];
}
}


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40nmr.mgh.harvard.edu


This email sent to email@hidden


_______________________________________________ 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
References: 
 >Using NSPropertyListSerialization with NSArray of NSDictionaries (From: Rick Hoge <email@hidden>)

  • Prev by Date: Re: Spotlight problem
  • Next by Date: Re: Is this a bug in Tiger's NSBitmapImageRep?
  • Previous by thread: Using NSPropertyListSerialization with NSArray of NSDictionaries
  • Next by thread: Re: Bindings between nib files? <!solved>
  • Index(es):
    • Date
    • Thread