I am attempting to fill up NSMutableArrays with an unknown sized list of strings.
I have declared the arrays and am reading in from a plist successfully into my tempWordStr, but when I try to append the array from the tempWordStr, the array object remains null. I tried a couple of variants (below) but the _wordLengthArray remains empty with 0 objects either way even though the tempWordStr has the string. This seems pretty basic but have been struggling for a couple of hours.
[_wordLengthArray addObject:tempWordStr];
[self.wordLengthArray addObject:tempWordStr];
Before you can call a method, such as
addObject:on an object, such asNSMutableArrayyou need to initialize it. So before all of your code, do_wordLengthArray = [NSMutableArray array];Speaking more generally, if you call a method on an object that hasn’t been initialized (aka it’s nil) it simply returns nil/null. That’s why you don’t get any errors, it just silently fails.