iPhone - Crash using addObject on a NSMutableArray

前端 未结 5 1529
悲哀的现实
悲哀的现实 2020-12-10 19:42

I have a problem here. Or Maybe I\'m really tired...

I have a class :

@interface THECLASS : UIViewController  {
    NSMuta         


        
5条回答
  •  时光取名叫无心
    2020-12-10 20:18

    After struggling a lot i found the solution for my problem. In my case the problem was,

    I have a mutable dictionary and array

    @property(strong,nonatomic)NSMutableDictionary *dictInfo;
    @property(retain,nonatomic) NSMutableArray *userAccountsList;
    

    And I am adding server array list to userAccountsList array like this

     self.dictInfo = [jsonObject valueForKey:@"customerAccountList"];
    

    I have taken another array and adding server array list to that array

    array = [self.dictInfo valueForKey:@"banker"];
    

    and finally adding array to userAccountsListArray like this

                    userAccountsList = [NSMutableArray arrayWithArray:array];
    

    And here adding additional object to array

                    [userAccountsList addObject:@"Other Account"];//I was getting error here.
    
                    [tableViewObj reloadData];
    

    Hope it helps someone. Please vote up if it helps.

提交回复
热议问题