I have the followin开发者_开发技巧g code:
    self.itemsCopy = [self.items mutableCopy];
    //[self.itemsCopy addObjectsFromArray:self.items];
    NSLog(@"------- BEFORE APPEND --------");
    NSLog(@"items count: %d",[items count]);
    NSLog(@"itemsCopy count: %d",[itemsCopy count]);
My results are:
 ------- BEFORE APPEND --------
 items count: 15
 itemsCopy count: 15
However if I change the first line from a mutableCopy to addObjectsFromArray:
[self.itemsCopy addObjectsFromArray:self.items];
My new results are:
 ------- BEFORE APPEND --------
 items count: 15
 itemsCopy count: 0
Why does mutableCopy populate itemsCopy, but addObjectsFromArray doesn't?
Because self.itemsCopy is nil as you missed to initialize it with a NSMutableArray.
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论