title: strong @property with __attribute__((NSObject)) for a CF type doesn't retain
body: <p><strong>UPDATE: This issue has been fixed as of Xcode 4.6!</strong></p>
  
  <p>This technique now works as intended again. However, make sure to read the notes at the top of Rob Napier's excellent answer before you use it in your code.</p>
  
  <p><strong>ORIGINAL POST</strong></p>
  
  <p>(ARC, Xcode 4.3.1, iOS 5.1)</p>
  
  <p>I have a strong property of a CF type (CGImage) that I want to be automatically managed by ARC using <code>__attribute__((NSObject))</code> (as in having retain &amp; release in the synthesized setter, and it being nil'ed in dealloc), but it doesn't work: the object is not retained when I assign the property.</p>
  
  <p>A minimal example to reproduce:</p>
  
  <pre><code>@interface TestClass : NSObject
  @property (nonatomic, strong) __attribute__((NSObject)) CFStringRef str;
  @end
  
  // ...In some function
  CFStringRef str = (__bridge CFStringRef)[NSString stringWithFormat:@"%g", 2.5];
  NSLog(@"%ld", CFGetRetainCount(str));
  TestClass *obj = [[TestClass alloc] init];
  obj.str = str;
  NSLog(@"%ld", CFGetRetainCount(str));
  </code></pre>
  
  <p>Which prints '1' twice.</p>
  
  <p>Now the strange thing is that (although I'm not sure of this) I think it worked properly before I updated to iOS 5.1 &amp; Xcode 4.3.1 (from iOS 5 &amp; Xcode 4.2), and with it switched from gdb to lldb. Can someone who hasn't upgraded (or knows how to change back the compiler) perhaps confirm?</p>