• 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 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

  • Follow-Ups:
    • Re: Error: mutating method sent to immutable object
      • From: Graham Cox <email@hidden>
  • Prev by Date: Re: IB Plugin help
  • Next by Date: Re: IB Plugin help
  • Previous by thread: Re: NSString* kMyKey = @"aKey" vs #define MYKEY @"aKey"
  • Next by thread: Re: Error: mutating method sent to immutable object
  • Index(es):
    • Date
    • Thread