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 05:27:12 +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]];
}
//[arregloNumeros release];
for (p = 0; p < 7; p++)
NSLog(@"Elemento %d en el arreglo numeros es: %@", 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 to fix it please.
Thanks in advance.
Priscila Jardón
_________________________________________________________________
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