Tag Archives: Cocoa

NSDateFormatter case sensitive trap

Though NSDateFormatter behaves slightly different than documented, the following might even be correct, as strange as it might look (mind the last two lines): -(void)testNSDateFormatterTrap { NSDateFormatter *lower = [[[NSDateFormatter alloc] init] autorelease]; lower.dateFormat = @"yyyy-MM-dd HH:mm:SS ZZZ";   NSDateFormatter *upper = [[[NSDateFormatter alloc] init] autorelease]; upper.dateFormat = @"YYYY-MM-dd HH:mm:SS ZZZ";   lower.timeZone = upper.timeZone [...]

CocoaTouch, CoreData and binary String Search

The query optimiser for NSPredicate queries ontop CoreData/SQLite on the iPhone is a bit rudimentary (cough) and so I had to optimise myself to get binary-search enabled quick results: The query optimiser for NSPredicate queries ontop CoreData/SQLite on the iPhone is a bit rudimentary (cough) and so I had to optimise myself to get binary-search [...]

Cocoa wrapped regex.h

Strange enough there’s no regular expression class in the iPhone SDK. Update: iOS 4 brings NSRegularExpression. My simple wrapper around the regex.h C API is not safe for unicode matching patterns but does the job e.g. for parsing URLs. If you need more, have a look at RegexKitLite. My simple wrapper has the interface: Strange [...]

NSDateFormatter & Http Header

Ever tried to get e.g. the “Last-Modified” HTTP response header field into a NSDate object? That’s no real fun, because this standard formatting isn’t digested by default, the required format string doesn’t quite work as documented. Ever tried to get e.g. the “Last-Modified” HTTP response header field into a NSDate object? That’s no real fun, [...]

NSURLCache Joke / iPhone

Did you ever wonder why Apple’s own Demo App URLCache doesn’t use the NSURLCache class, but rather reimplements disk caching instead? Well, it looks like NSURLCache promises disk-caching, but doesn’t keep this promise. Did you ever wonder why Apple’s own Demo App URLCache doesn’t use the NSURLCache class, but rather reimplements disk caching instead? Well, [...]

NSURLConnection gzip magic

For quite some time I ranted about not being able to use compressed network communcation out-of-the-box on the iPhone. Despite being undocumented (or I just overlooked the hint), NSURLConnection does gzip decompression transparently! That’s how to use it: For quite some time I ranted about not being able to use compressed network communcation out-of-the-box on [...]