NSMutableArray count always returns zero

前端 未结 3 1621
無奈伤痛
無奈伤痛 2021-01-12 13:09

I\'m sure I\'m doing something silly, but this is driving me crazy.

I\'m trying to loop through database results, create objects from those results, and add the obje

3条回答
  •  不要未来只要你来
    2021-01-12 13:16

    Another common cause (not in your case, as it turns out, but generally) is forgetting to even allocate the array. If you haven't created an array yet, you're sending that count message to nil, so the result will always be 0.

提交回复
热议问题