Note that there are some explanatory texts on larger screens.

plurals
  1. PO(NSDictionary *) labelAttrs = 0x00000001
    text
    copied!<p>Doing some debugging I printed out the description of an NSDictionary variable which gives this:</p> <pre><code>(NSDictionary *) labelAttrs = 0x00000001 </code></pre> <p>Can someone clarify why this is <code>1</code>?</p> <p>I'd understand <code>nil</code> or an object pointer but why <code>1</code>?</p> <p>UPDATE</p> <p>The code:</p> <pre><code>NSDictionary *labelAttrs = @{NSForegroundColorAttributeName:[UIColor darkGrayColor]}; </code></pre> <p>It crashes when run on iOS5 but not iOS6 but this:</p> <p><a href="https://stackoverflow.com/questions/12869703/are-the-new-object-literals-backwards-compatible-with-ios-5">Are the new object literals backwards compatible with iOS 5?</a></p> <p>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: <a href="https://developer.apple.com/library/ios/#releasenotes/ObjectiveC/ObjCAvailabilityIndex/index.html" rel="nofollow noreferrer">https://developer.apple.com/library/ios/#releasenotes/ObjectiveC/ObjCAvailabilityIndex/index.html</a></p> <p><img src="https://i.stack.imgur.com/pfPx1.png" alt="enter image description here"> </p> <p>Here's how it looks in Xcode before:</p> <p><img src="https://i.stack.imgur.com/apQlz.png" alt="enter image description here"></p> <p>Then when I Step over:</p> <p><img src="https://i.stack.imgur.com/GykzB.png" alt="enter image description here"> </p> <p>Note: this gives me the same crash:</p> <pre><code>NSDictionary *labelAttrs = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor darkGrayColor], NSForegroundColorAttributeName, [UIFont fontWithName:CUSTOMFONT size:size], NSFontAttributeName, [NSNumber numberWithInt:0], NSStrokeWidthAttributeName, nil]; </code></pre> <p>Removing this (and the following 2 lines of code) means the app runs without crashing. But obviously no attributed strings.</p> <p>UPDATE: resolved. Attributed strings aren't available on iOS5 (at least for UILabel's): <a href="https://stackoverflow.com/questions/13389647/is-nsattributedstring-available-before-ios-6">Is NSAttributedString available before iOS 6?</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload