【发布时间】:2013-04-24 22:49:25
【问题描述】:
我在 Xcode 中遇到了一个奇怪的问题。在我对这个 NSMutableArray 对象使用 insertObject:withIndex: 之后,调试窗口会显示数组的错误值,即使其他本地变量显示了正确的值,而且这个断言距离传递还有一步之遥。
我注意到我正在开发的应用程序中发生了这种情况,因为该对象上的方法似乎无法正常工作。我编写了单元测试来证明我遇到的问题,并期望它失败,但它通过了。这是我使用的单元测试:
NSMUtableArray *targetArray = [[NSMutableArray alloc] initWithObject:@"Initial 0 object", nil];
NSString *new0object = @"new 0 object";
[targetArray insertObject:new0object atIndex:0];
NSString *current0object = [targetArray objectAtIndex:0];
STAssertTrue([current0object isEqualToString:new0object], nil);
看这个:
我需要做什么才能让调试器正确显示,你认为它配置错误吗?
【问题讨论】:
-
浪费了整个晚上...整个上午,一直在思考....WTF 正在进行中。事实证明...xcode 向我显示了错误的值
标签: objective-c xcode debugging xcode4.6