Error: mutating method sent to immutable object
Error: mutating method sent to immutable object
- Subject: Error: mutating method sent to immutable object
- From: Priscila J.V. <email@hidden>
- Date: Sat, 4 Apr 2009 01:27:07 +0000
- Importance: Normal
Hello,
I'm trying to do this:
int p;
NSMutableArray * arregloNumeros = [[NSMutableArray alloc] init]; NSString * fileContents = [NSString stringWithContentsOfFile:@"lineasFinal.txt"]; NSEnumerator * lineFileEnumerator = [[fileContents componentsSeparatedByString:@"|"] objectEnumerator]; NSString * enumeratedFileLine; // Prepare to process each line of numbers NSEnumerator * numberEnumerator; NSString * numberAsString; while (enumeratedFileLine = [lineFileEnumerator nextObject]) { numberEnumerator = [[ enumeratedFileLine componentsSeparatedByString:@","] objectEnumerator]; while (numberAsString = [numberEnumerator nextObject]) { // change string to float float auxFloat = [numberAsString floatValue]; [arregloNumeros addObject:[NSString stringWithFormat:@"%f", auxFloat]]; } for (p = 0; p < 7; p++) NSLog(@"Position %d and number %@", p, [arregloNumeros objectAtIndex:p]);
[arregloNumeros release]; }
But when I run the program in my log window appears the following message:
-[NSCFArray addObject:]: mutating method sent to immutable object
Does anyone know what is going on? and help me please to fix it.
Thanks in advance.
Priscila
_________________________________________________________________
Découvrez toutes les possibilités de communication avec vos proches
http://www.microsoft.com/windows/windowslive/default.aspx_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden