NSMutableArray removeObjectAtIndex strange issue.

夙愿已清 提交于 2019-11-29 13:51:56

Are you using lldb for debugging? Try gdb if so.

lldb has known bugs of this nature where it reports the incorrect values of variables during a debug session.

To change the debugger to gdb:

  1. Click your target in the toolbar
  2. Select 'edit schemes'
  3. Make sure the 'run' scheme is selected in the pane on the left.
  4. Change the 'Debugger' dropdown from lldb to gdb.

your same code is working fine., just clean and build the project. here is my code

NSMutableArray *sampleArray = [[NSMutableArray alloc]
                         initWithObjects:@"1",@"2",@"3",@"4", nil];
NSLog(@"%@", sampleArray);
[sampleArray removeObjectAtIndex:0];
NSLog(@"%@", sampleArray);
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!