Re: NSString propertyList crash
Re: NSString propertyList crash
- Subject: Re: NSString propertyList crash
- From: Andy Lee <email@hidden>
- Date: Sun, 19 Mar 2006 22:20:46 -0500
On Mar 19, 2006, at 9:10 PM, Tito Ciuro wrote:
NSString *dirPath = [@"~/Library/Preferences/
com.apple.Bluetooth.plist" stringByExpandingTildeInPath];
NSDictionary *dict = [NSDictionary dictionaryWithContentsOfFile:
dirPath];
NSString *desc = [dict description];
NSDictionary *newDict = [desc propertyList];
It seems that the Bluetooth plist is wrongly formatted (needs a
missing semicolon) which crashes NSString's propertyList.
I can reproduce this, and it does look like a bug to me. The problem
seems to be with dates in the plist file. My Bluetooth.plist
contains an entry that gets converted to this by the -description
method:
RecentDevices = {
"00-0a-95-3a-84-5b" = 2006-03-18 23:56:58 -0500;
"00-0c-55-04-a6-6f" = 2006-03-17 04:01:14 -0500;
"00-60-57-e6-e1-83" = 2006-03-01 16:46:45 -0500;
};
This is a dictionary whose values are supposed to be dates.
Unfortunately, the parsing logic in the -propertyList method does not
recognize them as such. An exception gets thrown by
CFPropertyListCreateFromXMLData(), and does not get thrown when I
remove the dates.
Note that it does not help to use -descriptionInStringsFileFormat and
-propertyListFromStringsFileFormat.
I suspect the solution is to use whatever CoreFoundation function is
the inverse of CFPropertyListCreateFromXMLData(), because the
Objective-C APIs for doing what you want are broken right now.
Oh, and file a bug report. :)
--Andy
P.S. Keith Wilson, maybe you didn't run into the problem because
your Bluetooth.plist file doesn't have a "RecentDevices" entry?
_______________________________________________
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