I have java code which looks something like this:
for(int i=0;i<codeWord.length;i++) {
codeWord[i] = cw_bArray;
}
here the codeword is NSDATA & cw_barray is NSMutableArray and in Objective c i am doing
for(int i=0;i<codeword.length;i++) {
[codeword objectAtIndex:i] =[cw_bArray mutableCopy];
}
but it is popping a error like this
Assigning to ‘readonly’ return result of an objective-c message not allowed
Praven S solution works fine if you are looking for adding object to your array.
The java code seems more like a replacing object in the array by new ones. In order to achieve that you should use:
[codeword replaceObjectAtIndex:i withObject:[cw_bArray mutableCopy]];
Like he said,
objectAtIndexis a getter method. Hence you cannot assign a value to the method result. It would have no sense. Basically what you wrote is give me the i object of the array but you know what? Let say this object is another one.