nsmutabledictionary

How to update NSMutableDictionary. My code doesn't work.

I've populated an array using. arrSettings = [[NSMutableArray alloc] initWithContentsOfFile:[self settingsPath]]; The file is a plist with the root as an array and then a dictionary with three three keys defined as number. I've also tried setting the keys to string. I display the values in the plist file on a view using. diaper = [...

NSMutableDictionary can't have "time" to read objects (NSMutableString s)

Hi, I'am setting the text of labels with the content of NSMutableString_s which are objects of a NSMutableDictionray ... the problem that all things work fine when i load the page for two times (so i push ,after i pop...) and with the third push the program can't read the content of one of the NSMutableString_s of the NSMutableDictionary...

NSMUtableDictionary deallocation issue

Hi, I have got I have got two methods both in different classes. One is class method and other is instance method. i am calling class method from instance method. When instance method finishes it gives runtime error "EXC_BAD_ACCESS". #import "xmlObject.h" #import "textmeAppDelegate.h" @implementation Class1 - (void)method1 { ...

NSMutableDictionary memory / address problem, release does not work?

I am trying to create a NSMutableDictionary(dictA) with objectA. When I try to view my dictionary(NSLog), each key is pointing to the same address. I have an objectA_1 which is type objectA and used to setup the dictionary. Also, if I try to getObject, I always get the last key/value that was added to the dictionary. I tried setValue...

Passing NULL value

Hi. I use an instance of NSXMLParser. I store found chars in NSMutableStrings that are stored in an NSMutableDictionary and these Dicts are then added to an NSMutableArray. When I test this everything seems normal: I count 1 array, x dictionnaries and x strings. In a detailview controller file I want to show my parsed results. I call t...

iPhone ... If you have an NSArray of NSMutableDictionaries, does the Array hold a ref to the dict or a "copy"?

Okay, coming from a perl background I am used to Arrays holding refs to Hashes (Dictionary in iPhone parlance). What I would like to know is this: If I have a NSArray of NSMutableDictionaries. Say I added the following NSMutableDictionary to an NSArray: [theArray addObject:[[NSMutableDictionary alloc] initWithObjectsAndKeys: timest...

Should I release array returned from [NSMutableDictionary ValueForKey: ]

I have a NSMutableDictionary with the key being the first alphabet of the name of an object. The view is something like the 'Contacts' tab on iphone. Additionally user can select individual objects in the list. In the code I find each selected object to process them further. NSMutableArray *objectsToAdd = [[NSMutableArray alloc] init...

special characters in Objective-C plist

I had not run into this before but I wanted to know if it's possible to store KEYS with special characters in Objective-C / Cocoa Touch Since one can force a line break in a NSString with \n I wanted to store some values in a plist (and they do need to be the keys). It's just about 20 lines to static data (well, the keys, the values are...

Retrieving data from a NSDictionary

I am not quite sure I understand how to do the following. If I wanted to add e.g. an author and a title (key, value) to a dictionary. Fill that dictionary with data, then have another dictionary for say e.g. k = genre v = artist name and fill it with data. Then I want to add the dictionaries to an array. Firstly how is that done? a...

Editing a NSMutableDictionary's attribute that is a string from within UITableView

I have a NSMutableDictionary that I'm loading into a UITableview, The first level has "names" and the second level is "details". I want to be able to edit the attribute (strings) and then save them back into the Dictionary. I can't seem to find how to do this, every example I see uses Managed objects with a separate editor for each item...

How to change a NSMutableDictionary int value

I have a StateArray.plist set up with 50 dictionary entries each containing a string with the name of the state and a number 0. What I want to be able to do is change the 0 to a 1 through a segmented control and save the updated plist. The code I have is below and won't save the changed number. -(void) viewWillAppear: (BOOL) animated ...

Changing and saving NSMutableDictionary values

I have a StateArray.plist set up with 50 dictionary entries each containing a string with the name of the state and a number 0. What I want to be able to do is change the 0 to a 1 through a segmented control and save the updated plist and segmented control position. The code I have is below. Here is my .h file #import <UIKit/UIKit.h> #...

Memory leak problem with NSMutableDictionary

Hi, i'm writing a program which do something like that: - (void)viewDidLoad { [super viewDidLoad]; propertyList = [[NSMutableDictionary alloc] init]; for (SensorData* _data in _res) { AttributeLine* newLine=[[AttributeLine alloc] init:idx]; [propertyList setObject:newLine forKey:[_data textValue]]; [newLi...

Getting CFMutableDictionaryRef Values

Hello Everyone, I would like to access some values from a CFMutableDictionaryRef and then do some math on them. Using the code below I have managed to print some properties of my battery. I am also able to print out single values (although in doing so I get a warning:invalid receiver type:CFMutableDictionaryRef). Then I try to convert...

Plist files not being read

Hey there, my app has a search bar that searches a plist file. I've created the plist file but I keep getting this error: [Session started at 2010-07-27 19:11:07 +0530.] 2010-07-27 19:11:12.550 InfoCarApp[2062:20b] *** -[NSCFDictionary allkeys]: unrecognized selector sent to instance 0x3d51440 2010-07-27 19:11:12.552 InfoCarApp[2062:20b...

NSXMLParser and memory management issues

I've been trying to implement NSXMLParser and so far I've had memory issues, performance issues or it doesn't work. I worked originally from a example off the net and it leaked a heap of memory. I released the objects properly but found that there was a performance hit because I would alloc and then release each object for each element....

Memory Leak with NSMutableDictionary

Confused to why this line of code is causing a memory leak: NSPropertyListFormat format; NSMutableDictionary *d = [NSPropertyListSerialization propertyListWithData:rawCourseArray options:NSPropertyListMutableContainers format:&format error:NULL]; Any suggestions on a fix is much appreciated! Regards, B ...

Objective-C: Add an observer to an NSMutableDictionary that gets notified when count reaches 0

Hi there, I would like to be notified, when an NSMutableDictionary's count reaches 0. Is that possible without extending NSMutableDictionary (which I heard you should not really do)? Could I e.g. have a category that mimicks remove methods by calling the original ones while checking whether count is 0? Or is there maybe a simpler way. ...

Using one setter for all model iVars

I have a series of models for my application. Across all these models there are (will be) some 200 or 300 instance variables. The application stores its persistent data on a web-based server (MySQL - but I guess that part doesn't matter). Whenever a model iVar is updated I need to make a call to the server to update the appropriate value...

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 ? ...