-3

I have created a function within my code that converts whatever is in the textfield of my app to append to my array. However, when I set a breakpoint in the code, it returns that my array, _descriptionArray is nil. Why is that?

I want whatever value is in the descriptionTextField.text to append to my _descriptionArray.

Thanks for the help!

-(NSMutableArray *)descriptionConversion{

    [_descriptionArray addObject: (descriptionTextField.text)];


    return _descriptionArray;
}
Stonz2
  • 6,306
  • 4
  • 44
  • 64
B.L.
  • 1
  • 1

1 Answers1

1

Did you ever initialize _descriptionArray? If not, be sure to initialize the array with _descriptionArray = [NSMutableArray array];. If you don't initialize the array, it will be nil. You can only add an object to an array; not to nil.

keithbhunter
  • 12,258
  • 4
  • 33
  • 58