Q:

Why does -sizeWithFont: return different results in code and debugger?

This line:
NSLog(@"%@", NSStringFromCGSize([@"Test" sizeWithFont:((id)[UIFont systemFontOfSize:12.0f])]));

prints the correct result: {24, 15}.
However, when I do the same in the debugger (GDB or LLDB doesn't matter) I get a totally different result:
(gdb) p (CGSize) [@"Test" sizeWithFont:((UIFont*)[UIFont systemFontOfSize:12.0f])]
$1 = {
  width = 0, 
  height = 0
}

This happens on both the simulator and the device and on both the 5.1 final SDK as well as the 6.0 beta 3 SDK.
Any idea?

A:

OK, digging deeper, I found that the dynamic allocation of UIFont objects somehow fails in the debugger:
(gdb) p (CGFloat) [[UIFont systemFontOfSize:12.0f] pointSize]
$3 = 0
(gdb) po [UIFont systemFontOfSize:12.0f]
<UICFFont: 0x8e4b720> font-family: ".Helvetica NeueUI"; font-weight: normal; font-style: normal; font-size: 0px

So for some reason, the font objects created in the debugger environment have a font size of 0. The other attributes look good.
I have logged this as a bug: rdar://11934937

