Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error on Xcode: Expected method to write array element not found on object of type 'NSArray *'

I have another arrays problem...

I have declared an array as follows:

NSArray *sliderValAtTimes;

This is the code with the error: Code:sliderValAtTimes[x] = sliderValue;

Error: Expected method to write array element not found on object of type 'NSArray *'

Declarations:

int x = 0;
sliderValue = [[NSString alloc] initWithFormat:@"%0.0f", self.slider.value];

Any help would be great!

like image 959
Nisala Avatar asked Apr 11 '14 23:04

Nisala


1 Answers

NSArray is immutable. You can't replace an element of an NSArray. You need an NSMutableArray.

like image 101
rmaddy Avatar answered Oct 20 '22 00:10

rmaddy