Storing callbacks in a dictionary (Objective C for the iPhone)

Posted by Casebash on Stack Overflow See other posts from Stack Overflow or by Casebash
Published on 2010-01-20T00:57:10Z Indexed on 2010/03/21 0:11 UTC
Read the original article Hit count: 682

Filed under:

I am trying to store callbacks in a dictionary.

  • I can't use blocks as the iPhone doesn't support this (unless you use plblocks).
  • I tried using functions, but apparently NSMutableDictionary doesn't allow these pointers (wants an id)
  • I tried using class methods, but I couldn't find a way to obtain a pointer to these
  • I could try using functions with the c++ stl hashmap (if it is supported in Objective C++), but apparently this can slow compilation times.
  • I could try storing both a class and a selector, but that seems rather messy.

What would be the best way to do this?

© Stack Overflow or respective owner

Related posts about objective-c