Add object to NSMutableArray from other class

前端 未结 2 431
一个人的身影
一个人的身影 2021-01-23 12:36

I have a view controller class called PresidentsViewController that sets up data in a UITableView. This data is in the form of NSMutableArray

2条回答
  •  -上瘾入骨i
    2021-01-23 13:21

    My suspicion here would be that you have a property defined as @property (nonatomic,copy) NSMutableArray *list; Are you getting and exception trying to add the object into the array? If so, it's likely because the copy modifier is returning an immutable copy of the array. Try to create a method that takes the object and adds it to the list without using self.list ... just [list addObject] and if that works then this is your problem.

提交回复
热议问题