NSMutableArray removeObjectAtIndex奇怪的问题. [英] NSMutableArray removeObjectAtIndex strange issue.

查看:88
本文介绍了NSMutableArray removeObjectAtIndex奇怪的问题.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NSMutableArray中的奇怪行为.

我已经创建了对象并填充了它.

I've created object and filled it.

NSMutableArray *array = [[NSMutableArray alloc] 
                         initWithObjects:@"1",@"2",@"3",@"4", nil];
[array removeObjectAtIndex:0];

在删除之前,它看起来像:

Before removing it looks like:

array   NSMutableArray *    0x1040b5e0
[0] id  0x00088a44 @"1"
[1] id  0x00088a54 @"2"
[2] id  0x00088a64 @"3"
[3] id  0x00088a74 @"4"

删除FIRST元素后:

After removing FIRST element:

array   NSMutableArray *    0x1040b5e0
[0] id  0x00000000 
[1] id  0x00088a54 @"2"
[2] id  0x00088a64 @"3"

我在这里做错什么了?

推荐答案

您是否使用lldb进行调试?如果是这样,请尝试 gdb .

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

lldb具有这种已知的错误,它会在调试会话期间报告变量的错误值.

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

要将调试器更改为gdb:

  1. 在工具栏中单击目标
  2. 选择编辑方案"
  3. 确保在左侧窗格中选择了运行"方案.
  4. 将调试器"下拉菜单从lldb更改为gdb.

这篇关于NSMutableArray removeObjectAtIndex奇怪的问题.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆