• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Error: mutating method sent to immutable object
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Prev by Date: Re: Very interesting ordering caveat with NSArray arrayWithObjects:
  • Next by Date: Re: Screen recorder
  • Previous by thread: RE: Error: mutating method sent to immutable object
  • Next by thread: RE: Error: mutating method sent to immutable object
  • Index(es):
    • Date
    • Thread