Strange behaviour in 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"
After removing FIRST element:
array NSMutableArray * 0x1040b5e0
[0] id 0x00000000
[1] id 0x00088a54 @"2"
[2] id 0x00088a64 @"3"
What am i doing wrong here?
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:
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With