Quarter Life Crisis

The world according to Sven-S. Porst

« ToweredMainDangerous Bug in Apple’s Mail »

Dictionaries

166 words

I am currently working at a little programming project. After Deutsche Telekom's website turned out to be too braindead to analyse our phone bill properly, I decided to have my own little program for this task. While the main work is done and I am just adding some nice touches, there was a bit of pain on the way. Pain in the form of things to learn about the NSDictionary class.

The first thing is: You can use any object as a key for your entries in the dictionary, not only strings. A silly coincidence with my variable names and a couple of typos in #define statements got me into quite some trouble there that cost a lot of time tracking down and sorting out.

The second thing is: If you use your own classes as keys, you should RTFM properly, keep in mind that the keys are copied and and implement the -copyWithZone: and -hash methods. Once this is done, everything works like a charm.

December 29, 2002, 1:47

« ToweredMainDangerous Bug in Apple's Mail »

Comments on

Photos

Categories

Me

This page

Out & About

pinboard Links

People

Ego-Linking