Skip to content

Instantly share code, notes, and snippets.

@landonf
Created April 26, 2010 23:43
Show Gist options
  • Save landonf/380097 to your computer and use it in GitHub Desktop.
Save landonf/380097 to your computer and use it in GitHub Desktop.
#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();
}
@jonsterling
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment