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 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 initWithContentsOfFile doesn't work (there are 4
> values in the file), then suddenly changes its value after the line
>                        xxx = [NSMutableDictionary
> dictionaryWithContentsOfFile: aFile];
>
> Any suggestions?
>
>
> Fragment of code:
>
> in .h file (of NSView subclass)
> NSMutableDictionary *SimParamnames ;
> NSMutableDictionary *xxx ;
>
> in .m file
>
> in
> - (id) initWithFrame:(NSRect)frameRect
>
> SimParamnames = [NSMutableDictionary dictionary] ;
> [SimParamnames retain] ;
>
> in a later method
>        NSArray *filesToOpen = [oPanel filenames];
>       int i, count1 = [filesToOpen count];
>       for (i=0; i<count1; i++) {
>                        NSString *aFile = [filesToOpen objectAtIndex:i];
>                        printf("%s\n", [aFile UTF8String]) ;
>                        [SimParamnames removeAllObjects] ;
>                        [SimParamnames initWithContentsOfFile: aFile];
>                        NSLog(@"SimParamnames contains %d values",
> [SimParamnames count]) ;
>                        xxx = [NSMutableDictionary
> dictionaryWithContentsOfFile: aFile];
>                        NSLog(@"SimParamnames contains %d values",
> [SimParamnames count]) ;
>                        NSLog(@"xxx contains %d values", [xxx count]) ;
>                        result = 100 ;
>       }
>
> The output from this fragment is
>
> /Users/lss/Desktop/t1.SimParams
> 2008-05-27 22:55:03.239 Neuron1[1944:813] SimParamnames contains 0 values
> 2008-05-27 22:55:03.240 Neuron1[1944:813] SimParamnames contains 4 values
> 2008-05-27 22:55:03.241 Neuron1[1944:813] xxx contains 4 values
> Professor Leslie S. Smith,
> Dept of Computing Science and Mathematics,
> University of Stirling,
> Stirling FK9 4LA, Scotland
> [EMAIL PROTECTED]
> Tel (44) 1786 467435 Fax (44) 1786 464551
> www http://www.cs.stir.ac.uk/~lss/
> UKRI IEEE NNS Chapter Chair: http://ewh.ieee.org/r8/ukri/cis
>
>
>
>
>
> --
> The University of Stirling (a charity registered in Scotland, number
> SC 011159) is a university established in Scotland by charter at Stirling,
> FK9 4LA.  Privileged/Confidential Information may be contained in this
> message.  If you are not the addressee indicated in this message (or
> responsible for delivery of the message to such person), you may not
> disclose, copy or deliver this message to anyone and any action taken or
> omitted to be taken in reliance on it, is prohibited and may be unlawful.
> In such case, you should destroy this message and kindly notify the sender
> by reply email.  Please advise immediately if you or your employer do not
> consent to Internet email for messages of this kind.
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to