user810606
user810606

Reputation:

NSMutableArray is still null after calling the addObject method on it

[_noteTitles addObject:@"title"];
[_noteDescriptions addObject:@"description"];
[self.tableView reloadData];
NSLog(@"%@", [_noteDescriptions description]);
NSLog(@"%@", [_noteTitles description]);

Before those lines I synthesized both "_noteDescription", "_noteTitles." When the NSLog lines are called, on the console i get "(null)" for both arrays. This function will be called multiple times (not too often) to update the contents of a table, but right now the arrays are not getting populated.

Upvotes: 1

Views: 762

Answers (1)

albertamg
albertamg

Reputation: 28572

It looks like you did not initialize your arrays. Therefore, you are sending addObject: to nil and nothing happens. This also explains why NSLog() prints (null).

Note that @synthesize generates the accessors for your property, it does not initialize the backing instance variable.

Upvotes: 5

Related Questions