iPhone – Why doesn’t this don’t apply to the Xcode debug window “PO [mynsdatecomponent weekday”

Why does this not apply to the XCode debug window “po [myNsDateComponent weekday]”?

Specific example:

(gdb) po weEndDayTime


( gdb) po [weEndDayTime weekday]
0x2 does not appear to point to a valid object.

The -weekday method of NSDateComponents returns an int. But po does not apply to primitive value types, only pointer types.

In this case, it outputs 0x2 as the integer of the method Convert to pointer and look for the object with pointer address 0x2. It can’t find anything, so it gives this information.

If necessary, use p instead of appropriate type conversion:

(gdb) p (int) [weEndDayTime weekday]
$1 = 2

Why does this not apply to XCode debugging Window “po [myNsDateComponent weekday]”?

Specific example:

(gdb) po weEndDayTime


( gdb) po [weEndDayTime weekday]
0x2 does not appear to point to a valid object.

The -weekday method of NSDateComponents returns an int. But po does not apply to primitive value types, only pointer types.

In this case, it converts the integer output 0x2 of the method to a pointer and looks for an object with a pointer address of 0x2 It can’t find anything, so it gives this information.

If needed, use p instead of the appropriate type conversion:

(gdb ) p (int) [weEndDayTime weekday]
$1 = 2

Leave a Comment

Your email address will not be published.