Doing some debugging I printed out the description of an NSDictionary variable which gives this:
(NSDictionary *) labelAttrs = 0x00000001
Can someone clarify why this is 1
?
I'd understand nil
or an object pointer but why 1
?
UPDATE
The code:
NSDictionary *labelAttrs = @{NSForegroundColorAttributeName:[UIColor darkGrayColor]};
It crashes when run on iOS5 but not iOS6 but this:
Are the new object literals backwards compatible with iOS 5?
seems to say that you can use the new literals with iOS5 (as long as you build against iOS6 and use Xcode >= 4.5 and compile with latest LLVM - e.g see screen grab). And, according to Apple, I should be OK to use them: https://developer.apple.com/library/ios/#releasenotes/ObjectiveC/ObjCAvailabilityIndex/index.html
Here's how it looks in Xcode before:
Then when I Step over:
Note: this gives me the same crash:
NSDictionary *labelAttrs = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor darkGrayColor], NSForegroundColorAttributeName, [UIFont fontWithName:CUSTOMFONT size:size], NSFontAttributeName, [NSNumber numberWithInt:0], NSStrokeWidthAttributeName, nil];
Removing this (and the following 2 lines of code) means the app runs without crashing. But obviously no attributed strings.
UPDATE: resolved. Attributed strings aren't available on iOS5 (at least for UILabel's): Is NSAttributedString available before iOS 6?