identifier vs. index – the final showdown

We just fixed a bug in Canned that had been elusive for quite some time. We had gotten a few stray 1-star reviews mentioning crashes on startup, but none of our beta testers had found these issues and we were unable to reproduce the crash ourselves. To make matters worse, we hadn’t received any support request emails until December 1st, more than 3 months after release.

After finally getting some crash logs, the issue appeared to be with our calls to ABMultiValueCopyValueAtIndex which had never caused any problems before. Stack Overflow came to the rescue (as usual) once I found this post.

Most Address Book sample code I had referenced online was calling this function with an ABMultiValueRef and an ABMultiValueIdentifier as arguments, but the second parameter is actually supposed to be a CFIndex. There is an intermediate function (ABMultiValueGetIndexForIdentifier) that returns the correct index given the identifier, but what was tripping us up was the fact that it works for most contacts even when called incorrectly with the identifier.

I guess that’s what I get for learning programming in a language with strong type checking.

Thankfully, early reports suggest that the issue is fixed.

January 13, 2011 at 4:44 pm

@skoda on @technochocolate on