odd problem with NSMutableDictionary and initWithContentsOfFile

2008-05-29 Thread Leslie Smith
I very recently upgraded from 10.4.11 Xcode 2.5 to 10.5.2 and Xcode 3. The code below worked fine (i.e. correctly) on the earlier system, but now gives really unexpected results. Is there a known workround, or am I simply missing something? It appears that the method call

Re: odd problem with NSMutableDictionary and initWithContentsOfFile

2008-05-29 Thread Ken Ferry
Hi Leslie, The issue is that you cannot init an object more than once. See if [[NSMutableDictionary alloc] initWithContentsOfFile:] behaves as it ought. -Ken On Wed, May 28, 2008 at 12:58 AM, Leslie Smith [EMAIL PROTECTED] wrote: I very recently upgraded from 10.4.11 Xcode 2.5 to 10.5.2 and

Re: odd problem with NSMutableDictionary and initWithContentsOfFile

2008-05-29 Thread Michael Vannorsdel
You can't init an object more than once (well not an intended use). You do: SimParamnames = [NSMutableDictionary dictionary]; and later: [SimParamnames initWithContentsOfFile: aFile]; which are both initializing the object. The second init is either being ignored or perhaps corrupting

re: odd problem with NSMutableDictionary and initWithContentsOfFile

2008-05-29 Thread Leslie Smith
Hi: I found out what I was doing wrong: rather than [SimParamnames initWithContentsOfFile: aFile]; I should have had SimParamnames = [SimParamnames initWithContentsOfFile: aFile]; because within the documentation for initWithContentsOfFile it says Return Value: An initialized object—which

Re: odd problem with NSMutableDictionary and initWithContentsOfFile

2008-05-29 Thread Jason Stephenson
Leslie Smith wrote: Hi: I found out what I was doing wrong: rather than [SimParamnames initWithContentsOfFile: aFile]; I should have had SimParamnames = [SimParamnames initWithContentsOfFile: aFile]; A more normal way of doing the above is NSMutableDictionary *SimParamnames;

Re: odd problem with NSMutableDictionary and initWithContentsOfFile

2008-05-29 Thread Andy Lee
On May 29, 2008, at 9:41 AM, Leslie Smith wrote: because within the documentation for initWithContentsOfFile it says Return Value: An initialized object—which might be different than the original receiver ... and my original code assumes that the return value is the same object. This is

Re: odd problem with NSMutableDictionary and initWithContentsOfFile

2008-05-29 Thread Jens Alfke
On 29 May '08, at 6:41 AM, Leslie Smith wrote: I found out what I was doing wrong: rather than [SimParamnames initWithContentsOfFile: aFile]; I should have had SimParamnames = [SimParamnames initWithContentsOfFile: aFile]; No. As two people have said already, *you can't initialize an