Skip to content

Instantly share code, notes, and snippets.

@stigi
Created May 13, 2014 08:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stigi/52d11423d9999ee97aff to your computer and use it in GitHub Desktop.
Save stigi/52d11423d9999ee97aff to your computer and use it in GitHub Desktop.
//
// main.m
// nil
//
// Created by Ullrich Schäfer on 13.05.14.
// Copyright (c) 2014 nxtbgthng GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Object : NSObject
@property id property;
@end
@implementation Object @end
int main(int argc, const char * argv[])
{
@autoreleasepool {
Object *o1 = [Object new];
Object *o2 = [Object new];
Object *o3 = [Object new];
o2.property = @"2";
NSArray *array = @[o1, o2, o3];
NSArray *result = [array valueForKey:@"property"];
NSLog(@"Result: %@", result);
}
return 0;
}
@stigi
Copy link
Author

stigi commented May 13, 2014

Output:

Result: (
    "<null>",
    2,
    "<null>"
)

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