• 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: Property list invalid for format
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Property list invalid for format


  • Subject: Re: Property list invalid for format
  • From: Chris Kane <email@hidden>
  • Date: Wed, 5 Nov 2003 18:46:13 -0800

The badness is subtle, but is buried there in the output.

In the internal dictionary, the first listed key is of type CFNumber. To be a valid property list, a dictionaries keys must be CFStrings. The other types of plist objects are not valid keys in a plist dictionary.


Chris Kane
Cocoa Frameworks, Apple


On Nov 1, 2003, at 1:43 AM, Daniel Todd Currie wrote:

I have the following method for writing to an XML file:

- (void)updatePref:(NSDictionary *)tempDict
{
NSLog(@"%@", tempDict);

NSString *error;
NSData *prefData = [NSPropertyListSerialization dataFromPropertyList:tempDict format:NSPropertyListXMLFormat_v1_0 errorDescription:&error];

if (!prefData)
{
NSLog(error);
[error release];
}
else
{
[prefData writeToFile:[plistPath stringByExpandingTildeInPath] atomically:YES];
}

[...]
}

This method works in all of the places it is used, except for a particular NSDictionary. The output of the above NSLogs for the offending NSDictionary are as follows:

2003-11-01 00:48:04.958 TestApp[3848] <CFDictionary 0x3ab470 [0xa01900e0]>{type = mutable, count = 3, capacity = 4, pairs = (
0 : <CFString 0xaf0a4 [0xa01900e0]>{contents = "targets"} = <CFDictionary 0x3b5d40 [0xa01900e0]>{type = immutable, count = 1, capacity = 1, pairs = (
0 : <CFNumber 0x383760 [0xa01900e0]>{value = +0, type = kCFNumberSInt32Type} = <CFDictionary 0x39b4d0 [0xa01900e0]>{type = immutable, count = 5, capacity = 5, pairs = (
3 : <CFString 0xaf064 [0xa01900e0]>{contents = "targetPeriod"} = <CFNumber 0x363fb0 [0xa01900e0]>{value = +12, type = kCFNumberSInt32Type}
4 : <CFString 0xaf094 [0xa01900e0]>{contents = "targetLastDate"} = <CFString 0x39bb30 [0xa01900e0]>{contents = "n/a"}
8 : <CFString 0xaf074 [0xa01900e0]>{contents = "periodUnit"} = <CFString 0x39cbc0 [0xa01900e0]>{contents = "hours"}
9 : <CFString 0xaf084 [0xa01900e0]>{contents = "targetOverwrite"} = <CFBoolean 0xa0190b98 [0xa01900e0]>{value = false}
10 : <CFString 0xaf054 [0xa01900e0]>{contents = "targetName"} = <CFString 0x383830 [0xa01900e0]>{contents = "~/Documents"}
)}
)}
3 : <CFString 0x359eb0 [0xa01900e0]>{contents = "startWarned"} = <CFBoolean 0xa0190b90 [0xa01900e0]>{value = true}
4 : <CFString 0xaf1a4 [0xa01900e0]>{contents = "archiveDir"} = <CFString 0x3835a0 [0xa01900e0]>{contents = "~/Documents/Archives"}
)}
2003-11-01 00:48:04.958 TestApp[3848] Property list invalid for format

As you can see, the NSDictionary is made up entirely of legitimate object types for plists... I have tried a number of things, and I have all but given up. Thanks to those of you who put in an effort to understand the problem (sorry for sending all this crunky output).

// Daniel Currie
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Property list invalid for format (From: Daniel Todd Currie <email@hidden>)

  • Prev by Date: Re: libcrypto... again
  • Next by Date: Re: custom AppleScript command and NSApp delegate
  • Previous by thread: Property list invalid for format
  • Next by thread: LSUIElement problems
  • Index(es):
    • Date
    • Thread