nsdictionary

How can i get Original order of NSDictionary/NSMutableDictionary ??

i have created NSMutableDictionary with 10 keys.Now i want to access NSMutableDictionary keys in a same order as it was added to NSMutableDictionary (using SetValue:* forKey:* ); How can i achieve that ? ...

Searching NSArray for an object

I have NSArray consisting of NSDictionary objects. Need to find index in NSArray of object with matching key name in NSDictionary. Dictionary has only 1 element. What is the fastest way of doing that? Filter with predicate and then use indexOfObject? ...

Objective C - NSDictionary Question

Hi I am a newbie to objective C and was wondering how I could form an NSDictionary with the following structure. level 1     level attribute 1.1 - level score - level percent     level attribute 1.2 - level score - level percent     level attribute 1.3 - level score - level percent level 2     level attribute 2.1 - level score - level ...

(null) values in NSMutableArray after inserting an NSMutableDictionary

I'm using an NSXMLParser to grab data and build an array of dictionaries with some information on a set of photos. Whenever I attempt to add a dictionary to the array, the value is always (null) Code: - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSStr...

Objective C: Memory Leak of Dictionary used in singleton..

I am using a singleton class to share data between views in my iphone app. My singleton class contains a dictionary which I allocate in my -init method: - (id)init { if ( self = [super init] ) { self.dataList = [[NSMutableDictionary alloc]init]; } return self; } I release it in my dealloc metho...

NSDictionary writeToFile

Is there a size limit to saving dictionaries? I am attempting to write a rather large dictionary with around 100 keys with nested dictionaries using writeToFile: but it never writes and is always false. Is this a limitation or am I doing something incorrect, The code i use is the following. NSArray *paths = NSSearchPathForDirectories...

Sort JSON NSDictionary for UITableView

Hi, I am using TouchJSON to retrieve info for my app and put it in a dictionary. I would like to be able to sort it by values like difficulty and rating. How would I go about this? I have included my .m file. Thanks, enbr http://pastie.org/1091334 ...

Saving High Score Data

I am extreamly new to programming. I am writing a simple game which gives you a score everytime you run the game. I am trying to figure out how to save the scores and recall them to a high score page. I am trying to figure out if saving to a dictionary is the best way, or using an array, or what. Plus, how does the dictionary handle ...

How do I convert a Java Hashtable to an NSDictionary (obj-C)?

At the server end (GAE), I've got a java Hashtable. At the client end (iPhone), I'm trying to create an NSDictionary. myHashTable.toString() gets me something that looks darned-close-to-but-not-quite-the-same-as [myDictionary description]. If they were the same, I could write the string to a file and do: NSDictionary *dict = [NSDicti...

Can I use protocol objects as keys in an NSDictionary?

I've read in Apples docu that (as I expected) an NSDictionary is not constrained just to strings for keys. There's also a post here confirming that Sets can be used. I want to use protocol objects but it' not happening. I initWithObjectsAndKeys and pass @protocol(MyGreatProtocol) as a key. Compiles but I get a runtime error saying someth...

Nested NSArray/NSDictionary Problem

I have an NSArray containing several NSDictionaries. I have an NSString containing an ID string. What I'm trying to do is iterate through the NSDictionaries until I find the object that matches the NSString. Then I want to return the entire NSDictionary. I'm fairly new to iPhone development, so I'm probably missing something obvious.....

Is this possible with NSDictionary? Or should I use something else?

What I am trying to do is create a an array of text strings, and I want to select a random text string out of this array, which I could normally do easily with an array. However, I would also like to be able to put them into categories, and when I select a random one, I would like to know what category it is in and do something different...

Strange doubt in NSDictionary iphone

Hey All, I know this is a silly doubt but I just want to make sure before I implement in this project. Please help....I have a NSDictionary with a string object in it. String is concatenated with 4fields. I am trying to display this string on the Detail View Controller in UITableView on iphone. For example my String is formatted as foll...

container of mixed types in C++ (similar to nsdictionary)

What I would like to do (in C++) is create a 'Parameter' data type which has a value, min, and max. I would then like to create a container for these types. E.g. I have the following code: template <typename T> class ParamT { public: ParamT() { } ParamT(T _value):value(_value) { } P...

NSMutableDictionary with capacity

What happens when you try to add to an NSMutableDictionary once it has already reached its capacity limit of objects? Does this bump one out or is this going to throw an exception? Also is there any way to have it bump out the oldest dictionary object when I add a new one? ...

How can we limit the capacity of an NSMutableDictionary?

Is there any way to create a mutable dictionary with a capacity limit rather than an initial capacity? Say you want to create a dictionary that will only ever have, at most, 100 entries. The capacity argument for the dictionary is an initial capacity that will be simply increased if you add more elements than you want so it's not suita...

NSDictionary : How to filter by match or closest value

How would I search my dictionary for the closest value to the query? Say I search for 0.000475, I know it's not available but I want to return it's closest value 0.000500. I suppose I would use keysOfEntriesPassingTest to achieve this on a dictionary, clueless on how to go about it though. <key>1/8000</key><real>0.000125</real> <key>1...

Get all CFBundleTypeExtensions of an Info.plist

Hi, I would like to get all the extensions of files my app can open. And I'd like to get them from my Info.plist. Right now I have this, but is there a better alternative? NSMutableArray *types = [NSMutableArray new]; NSArray *documentTypes = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleDocumentTypes"]; for (NSDictionar...

Can i sort the NSDictionary on basis of key in Objective-C?

Hello, Can i sort the NSDictionary on basic of key ? Thank You. ...

Can NSArray hold NSDictionary in Objective-C/

Hello, Can each index of array hold the NSDictionary? Thank You. ...