7

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!

1 Answer 1

15

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

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you! It looks like that format made the error go away.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.