Skip to content

Instantly share code, notes, and snippets.

@alanjrogers
Created September 21, 2012 01:42
Show Gist options
  • Save alanjrogers/3759329 to your computer and use it in GitHub Desktop.
Save alanjrogers/3759329 to your computer and use it in GitHub Desktop.
__attribute(NSObject)__ test
#import <Foundation/Foundation.h>
@interface TestClass : NSObject
@property (nonatomic, strong) __attribute__((NSObject)) CFStringRef str;
@end
@implementation TestClass
@end
int main(int argc, char* argv[]) {
@autoreleasepool {
CFStringRef str = CFStringCreateWithFormat(NULL, NULL, CFSTR("%f"), 2.5);
TestClass *obj = [[TestClass alloc] init];
obj.str = str;
CFRelease(str), str = NULL;
NSLog(@"obj.str %@", obj.str);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment