Is NSDictionary key order guaranteed the same as initialized if it never changes?

Posted by Thaurin on Stack Overflow See other posts from Stack Overflow or by Thaurin
Published on 2010-03-22T23:14:33Z Indexed on 2010/03/22 23:21 UTC
Read the original article Hit count: 302

I've run into the same problem as found in this question. However, I have a follow-up question. I seem to be in the same situation as the original asker: I have a plist with a hierarchy of dictionaries that define a configuration screen. These are not mutable and will stay the same throughout the application. Since the original discussion seems to focus on problems arising from mutating the dictionary, I must ask for comfirmation: is the order of a dictionary guaranteed the same as they are in the plist, i.e. as it is read (with initWithContentsOfFile)? Can I use allKeys on it in this case to get a correct-order array of keys if the dictionary never changes?

© Stack Overflow or respective owner

Related posts about objective-c

Related posts about nsdictionary