Created
April 26, 2010 23:43
-
-
Save landonf/380097 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@protocol PropertyProtocol | |
@property(readonly) NSString *example; | |
@end | |
int main (int argc, char *argv[]) { | |
id<PropertyProtocol> prop = nil; | |
/* Property access works fine here. */ | |
NSLog(@"%@", prop.example); | |
/* ... but not here: | |
* "error: request for member ‘example’ in something not a structure or union" */ | |
void (^Block)() = ^{ | |
NSLog(@"%@", prop.example); | |
}; | |
Block(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This may be a stupid question, but what if you use
__block id prop = nil;
I can't imagine how that would help, but perhaps it would work.