• 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: NSString propertyList crash
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • Re: NSString propertyList crash
      • From: Andy Lee <email@hidden>
    • Re: NSString propertyList crash
      • From: Greg Herlihy <email@hidden>
References: 
 >NSString propertyList crash (From: Tito Ciuro <email@hidden>)

  • Prev by Date: Re: White caret cursor, how to do it?
  • Next by Date: Re: Accessing NSTableView bindings' datasource
  • Previous by thread: Re: NSString propertyList crash
  • Next by thread: Re: NSString propertyList crash
  • Index(es):
    • Date
    • Thread