Shiki

I'm so bad with words that I can't even make a cool tagline

Category Archives: Objective-C

Using an object’s id as a key in NSDictionary

I was working on a utility class and was playing with the idea of using the id of an object (e.g. NSObject) as a key in NSDictionary. Setting it directly doesn’t work though: NSObject *obj = [[[NSObject alloc] init] autorelease]; // we’ll use this as the key NSMutableDictionary *dict = [[[NSMutableDictionary alloc] init] autorelease]; [dict [...]

Core Data error: Unsupported expression type (11, SIZE)

Yeah, so I’ve been learning Core Data and I keep getting this error during a fetch request: Name: NSInvalidArgumentException File: Unknown Line: Unknown Reason: Unsupported expression type (11, SIZE) An obscure error message, yay! This happened when I used this very simple predicate declaration: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"size == %@", @"medium"]; Like one of [...]