This tutorial is heavily based on Rupert’s article here. However, the steps in this article are very different on some points. There are some steps that I had to figure out using other sources.
Posts Categorized: Objective-C
I discovered this by accident. It’s probably been there for a long time but I just noticed it now. Normally, if you have very few rows in your table, it would look like this:
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 setObject:@"a value" forKey:obj]; // won't work
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 those bad days, Google doesn’t help. It took me an hour or two to figure out that
size is a reserved word in Core Data. Epic fail. You can fix this by escaping
size using a hash (
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"#size == %@", @"medium"];