0

There have been a lot of questions about this warning message but it usually indicate an error. I wonder how this warning should be debugged, generally ? And what does it mean ?

I have a case which I already know how to fix it:

NSDictionary *lastUpdatedAt = [NSDictionary dictionaryWithObjectsAndKeys:
                               @"es", [NSDate distantPast], 
                               @"it", [NSDate distantPast], nil];
[[NSUserDefaults standardUserDefaults] registerDefaults:
 [NSDictionary dictionaryWithObjectsAndKeys:
  @"es", @"lang", 
  [NSNumber numberWithInt:0], @"groupedBy",
  [NSNumber numberWithBool:FALSE], @"hideKnownWords", 
  lastUpdatedAt, @"lastUpdatedAt",
  nil]];

The bug is that when initializing lastUpdatedAt, I incorrectly put the keys where there should been values. And the fix is:

NSDictionary *lastUpdatedAt = [NSDictionary dictionaryWithObjectsAndKeys:
                               [NSDate distantPast], @"es", 
                               [NSDate distantPast], @"it",nil];

However, in the code with this bug, if you put a breakpoint at the line which calls registerDefaults, the warning is generated each time you try to advance the breakpoint, but it never returns. The bug is not actually in that line. I was lucky that the buggy line was close so that I noticed it immediately. But in general, how should this kind of bug be tracked ?

tzuchien.chiu
  • 700
  • 6
  • 11

0 Answers0