Friday, November 13, 2009

Dangerous Cocoa Calls

Mike Ash has a great list of Cocoa APIs that are subtly dangerous. Note that since NSBundle isn’t threadsafe, neither is NSLocalizedString.

Update (2017-02-20): Charles Srstka:

In Swift 3, NSFileHandle was renamed to FileHandle, making it the de facto file handle class for use in Swift applications. Unfortunately, it’s not a very good API. NSFileHandle supports no error reporting whatsoever, instead throwing Objective-C exceptions whenever something goes wrong during reading or writing. There is no way that I know of to catch these exceptions in Swift, meaning that if a write failed because the disk ran out of space or something, there’s no way to deal with that other than crashing the whole application.

Comments RSS · Twitter

Leave a Comment