• 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: Problems parsing plist files
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems parsing plist files


  • Subject: Re: Problems parsing plist files
  • From: "I. Savant" <email@hidden>
  • Date: Mon, 7 Nov 2005 09:50:39 -0500

Have you tried looking at the URL with your favorite web browser? It's not coming through as a valid PLIST file and so dictionaryWithContentsOfURL: returns nil. Either the file itself was modified on the server or the server is doing something strange to the file.

I had a problem where my hosting service provider made some changes to their server. Those changes for whatever reason were mangling the PLIST file (a simple text file). I remember having to change the extension to .txt (because they wouldn't undo their changes) and the web server correctly served the document without attempting to modify it.

--
I.S.


On Nov 7, 2005, at 7:20 AM, Peter Schols wrote:

Hi,

I'm experiencing a very strange problem. The following code initializes an NSDictionary with a .plist file on my web server. This code used to work just fine over the past 3 years (and it sill worked a few weeks ago) but now it does not work anymore:

NSString *traceList = @"http://www.orbicule.com/UCservices/ trace.plist";
NSURL *traceURL = [NSURL URLWithString:traceList];
NSDictionary *traceDictionary = [NSDictionary dictionaryWithContentsOfURL:traceURL];
NSLog(@"Trace dbase: %@", traceDictionary);


The traceDictionary is null and the run log shows the following message:

2005-11-07 13:03:45.932 uc[850] CFLog (0):
CFPropertyListCreateFromXMLData(): plist parse failed; the data is not proper UTF-8. The file name for this data could be:
/Users/mac/Library/Cookies/Cookies.plist
The parser will retry as in 10.2, but the problem should be corrected in the plist.
2005-11-07 13:03:46.006 uc[850] Trace dbase: (null)


Since the code looks fine to me and since it used to work just fine about two weeks ago, I'm clueless about what could be going wrong here.
When I replace the second line with the following line of code, it does work:
NSURL *traceURL = [NSURL fileURLWithPath:@"/Users/mac/Sites/ Orbicule/UCServices/trace.plist"];


So it seems like the NSDictionary can be initialised using a local file but not using a file on my web server. Moreover, other code in my app that does similar things (i.e. initialising dictionaries with plist files) gives similar error messages, even when the plist file is local.

I have searched the archives and I found some references to CFPropertyListCreateFromXMLData but they don't seem to apply here. I have played with different encodings and I have used the plutil tool to no avail.

Thanks a lot in advance!

Peter


Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm

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


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
  • Follow-Ups:
    • Re: Problems parsing plist files
      • From: Darkshadow <email@hidden>
References: 
 >Problems parsing plist files (From: Peter Schols <email@hidden>)

  • Prev by Date: Re: Easy backtrace
  • Next by Date: Re: Reviews of "Advanced Mac OS X Programming"
  • Previous by thread: Problems parsing plist files
  • Next by thread: Re: Problems parsing plist files
  • Index(es):
    • Date
    • Thread