NSMutableArray addObject not working

前端 未结 2 1927
时光说笑
时光说笑 2020-11-22 01:07

I have declared an NSMutableArray *categories in my view controller .h file, and declared a property for it.

In the parser:foundCharacters:

2条回答
  •  北海茫月
    2020-11-22 01:54

    The "0x0" part is a memory address. Specifically, "nil", which means your mutable array doesn't exist at the time this is being called. Try creating it in your -init method:

    categories = [[NSMutableArray alloc] init];
    

    Don't forget to release it in your -dealloc.

提交回复
热议问题