Re: NSDictionary crash

2009-07-26 Thread Aaron Burghardt
On Jul 26, 2009, at 6:50 PM, slasktrattena...@gmail.com wrote: On Sun, Jul 26, 2009 at 8:04 PM, Aaron Burghardt wrote: Interesting and not surprising. What I was suggesting, though, is that the amount of time needed to read the data is probably small compared to the time spent parsing the

Re: NSDictionary crash

2009-07-26 Thread slasktrattena...@gmail.com
On Sun, Jul 26, 2009 at 8:04 PM, Aaron Burghardt wrote: > Interesting and not surprising. What I was suggesting, though, is that the > amount of time needed to read the data is probably small compared to the > time spent parsing the data into a plist. Good point. So I ran a second test. Turns out

Re: NSDictionary crash

2009-07-26 Thread slasktrattena...@gmail.com
On Sun, Jul 26, 2009 at 3:58 AM, Aaron Burghardt wrote: > Why use Core Foundation?  How about (written in Mail): Thanks for your reply. I ran a test, and it seems CF is slightly faster: 2009-07-26 18:11:52.545 tst[31180:813] CF: Read 4611 tracks in 0.505728 seconds 2009-07-26 18:11:53.585 tst[311

Re: NSDictionary crash

2009-07-25 Thread Aaron Burghardt
Why use Core Foundation? How about (written in Mail): - (NSDictionary *)dictionaryFromPropertyListFile:(NSString *)path error:(NSError **)outError { NSData *data = [NSData dataWithContentsOfFile:path options:NULL error:&outError]; if (!data) return nil; NSString *errorStr

Re: NSDictionary crash

2009-07-25 Thread Jean-Daniel Dupas
Le 25 juil. 09 à 21:59, slasktrattena...@gmail.com a écrit : On Sat, Jul 25, 2009 at 9:39 PM, Kyle Sluder wrote: As I mentioned, look at NSPropertyListSerialization. NSDictionary is a plist type and can be decoded from an NSData. OK, thanks. Also, is the NSData equivalent any safer than

Re: NSDictionary crash

2009-07-25 Thread slasktrattena...@gmail.com
On Sat, Jul 25, 2009 at 10:21 PM, Kyle Sluder wrote: > Also not a safe option; other Apple apps can access the XML file, includeing > CoreServices (for the media picker in the Open panel). Unfortunately we > don't know how they do it and therefore can't be guaranteed that they won't > also break if

Re: NSDictionary crash

2009-07-25 Thread Kyle Sluder
On Jul 25, 2009, at 12:59 PM, "slasktrattena...@gmail.com" > wrote: Sorry for being ignorant, but how do I ensure the safety of the file? I don't see anything about this in the NSData API. Look at other APIs in the system. The point is to wind up with an NSData; this doesn't mean the API you u

Re: NSDictionary crash

2009-07-25 Thread slasktrattena...@gmail.com
On Sat, Jul 25, 2009 at 9:39 PM, Kyle Sluder wrote: > As I mentioned, look at NSPropertyListSerialization. NSDictionary is a plist > type and can be decoded from an NSData. OK, thanks. >> Also, is the NSData equivalent any safer than NSDictionary's? It's >> initWithContentsOfFile: method is docum

Re: NSDictionary crash

2009-07-25 Thread Kyle Sluder
On Jul 25, 2009, at 12:25 PM, "slasktrattena...@gmail.com" > wrote: You mean because it might be rewritten or corrupted while my app is reading it, or because the format might change in the future? I was referring to the latter. Of course you've already noted the former. Yes, but then iTu

Re: NSDictionary crash

2009-07-25 Thread slasktrattena...@gmail.com
On Sat, Jul 25, 2009 at 9:28 PM, Alexander Heinz wrote: > > On Jul 25, 2009, at 11:20 AM, Kyle Sluder wrote: > >> On Jul 25, 2009, at 11:00 AM, "slasktrattena...@gmail.com" >> wrote: >> >>> I find the third option the most likely: iTunes rewrites the data file >>> frequently. Is there a way to loc

Re: NSDictionary crash

2009-07-25 Thread Alexander Heinz
On Jul 25, 2009, at 11:20 AM, Kyle Sluder wrote: On Jul 25, 2009, at 11:00 AM, "slasktrattena...@gmail.com" > wrote: I find the third option the most likely: iTunes rewrites the data file frequently. Is there a way to lock the file while reading it, or detect if it is being modified, or suc

Re: NSDictionary crash

2009-07-25 Thread slasktrattena...@gmail.com
On Sat, Jul 25, 2009 at 8:20 PM, Kyle Sluder wrote: > On Jul 25, 2009, at 11:00 AM, "slasktrattena...@gmail.com" > wrote: > >> I find the third option the most likely: iTunes rewrites the data file >> frequently. Is there a way to lock the file while reading it, or >> detect if it is being modifie

Re: NSDictionary crash

2009-07-25 Thread Kyle Sluder
On Jul 25, 2009, at 11:00 AM, "slasktrattena...@gmail.com" > wrote: I find the third option the most likely: iTunes rewrites the data file frequently. Is there a way to lock the file while reading it, or detect if it is being modified, or suchlike? Thanks. You aren't guaranteed that the iTunes

Re: NSDictionary crash

2009-07-25 Thread slasktrattena...@gmail.com
On Sat, Jul 25, 2009 at 7:53 PM, Bill Bumgarner wrote: > On Jul 25, 2009, at 10:04 AM, slasktrattena...@gmail.com wrote: > >> I have never been able to reproduce this one myself, but have received >> a number of similar crash reports. The crash occurs on this line >> (detached thread): >> >> NSDict

Re: NSDictionary crash

2009-07-25 Thread Bill Bumgarner
On Jul 25, 2009, at 10:04 AM, slasktrattena...@gmail.com wrote: I have never been able to reproduce this one myself, but have received a number of similar crash reports. The crash occurs on this line (detached thread): NSDictionary *iTunesLib = [[NSDictionary alloc] initWithContentsOfFile:lib

Re: NSDictionary crash

2009-07-25 Thread slasktrattena...@gmail.com
On Sat, Jul 25, 2009 at 7:04 PM, slasktrattena...@gmail.com wrote: > Hello, > > I have never been able to reproduce this one myself, but have received > a number of similar crash reports. The crash occurs on this line > (detached thread): > > NSDictionary *iTunesLib = [[NSDictionary alloc] > initW