nsmutabledictionary

view contents of NSMutableDictionary

Hello, How to view the contents of NSMutableDictionary? Thank You ...

NSMutableDictionary with single key holding many values in Objective-C programming

Hello, Please tel me how to have many values for the same key in NSMutableDictionary? because when i use the below approach , the values are being replaces with the recent one In my case: [dictionary setObject:forename forKey:[NSNumber numberWithint:code]]; [dictionary setObject:surname forKey:[NSNumber numberWithint:code]]; [dictiona...

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

Adding data to an NSDictionary... SRSLY? Isn't there a quicker way?

I'm from a Flash ActionScript background. Where I'm from, I can set a dictionary-like object like this: var data:Object = {startPoint:5, endPoint:12}; So coming to Objective-C, I was surprised to discover that the equivalent to this appears to be: NSMutableDictionary *data = [NSMutableDictionary dictionary]; [data setObject:[NSNumber...

NSMutableDictionary may not respond to '-setValue:forKey:'

Getting "NSMutableDictionary may not respond to '-setValue:forKey:'" error from this code: NSMutableDictionary *parameters = [[[NSMutableDictionary alloc] init] autorelease]; MKFacebookRequest *request = [MKFacebookRequest requestWithDelegate:self]; //set up parameters for request [parameters setValue:[NSArray arrayWithObjects:[fbConne...

Using non-copyable object as key for NSMutableDictionary?

I tried to figure out this code referencing: http://stackoverflow.com/questions/1187112/cocoa-dictionary-with-enum-keys + (NSValue*)valueWithReference:(id)target { return [NSValue valueWithBytes:&target objCType:@encode(id*)]; } And, [table setObject:anObject forKey:[NSValue valueWithReference:keyObject]]; But it feels somethin...

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

Sort NSMutableArray

please help me I want to sort NSMutableArray and yes I can do this by NSSortDescriptor *sortPoint = [[NSSortDescriptor alloc] initWithKey:@"point" ascending:YES]; [hightScore sortUsingDescriptors:[NSArray arrayWithObject:sortPoint]]; but in NSMuatableArray(hightScore), I have 2 NSMutableDictionary like this [item setObject:@"player_n...

Remotely write to a .plist file iPhone SDK

I am wondering if theres a way to remotely write to a plist file stored on my server. The directory the file is located has write access, but i cannot seem to push the new data. Heres my code: NSString *accountURL = [NSString stringWithFormat:@"http://www.mywebsite.com//%@.plist",txtUsername.text]; NSURL *url = [NSURL URLWithString:acco...

How to change a value inside a dictionary in an array that's inside a dictionary?

I have a plist dictionary with several arrays where each have different number of items. These items are dictionaries too. So basically it looks like this: Root dictionary names array places array Item 0 dictionary Item 1 dictionary placeName string: "House" description string: "My House" height number: 10 Item 2 dictionary ... colo...

iPhone: Can't set object received from thread in NSMutableDictionary

I've got a thread (specifically an NSOperation) that runs to load some images for me for a scroll view when my main view asks for them. Any number of these NSOperations can be queued at once. So it goes with the filepath I give it and loads the image from the disk (as UIImages) and then sends the object back to my mainview by using perfo...

iPhone: Memory Leak in Custom Class and NSMutableDictionary

I've spent a couple of days trying to find out what's going on. I have read loads of Memory Management documentation and I am sick to death of hearing "for every alloc you need a release" - I know that and I still can't figure out why my code is producing memory leaks. I am writing a simple custom class with an NSMutableDictionary as on...

NSMutableDictionary error

I want to use NSMutableDictionary to cache some data i will use later. My custom object is following: @interface MyData : NSObject { NSRange range; NSMutableArray *values; } @property (nonatomic, retain) NSMutableArray *values; and implement: - (id)init { if (self = [super init]) { values = [[NSMutableArray alloc]...

How to check if the value in an NSDictionary exists in an array of dictionarys

The title is a bit confusing...I'll explain I have an NSMutableArray I am populating with NSMutableDictionary objects. What I am trying to do is before the dictionary object is added to the array, I need to check whether any of the dictionaries contain a value equal to an id that is already set. Example: Step 1: A button is clicked se...

Yet Another Leaking NSMutableDictionary Post

I've pounded my head against my monitor for hours (and read similar posts). I'm still stumped. I declare an array in my *.h file that will display data in a table view: @interface TeamsTableViewController : UITableViewController <UITableViewDelegate, UITableViewDataSource> { NSMutableArray *teamsArray; } I allocate the array in ...

iPhone SDk: Cannot add items to a NSMutableDictionary used as a property of a class?

When using a property of type NSMutableDictionary outside of the class I cannot add objects. This is the class.h file @interface cSummary : NSObject { @public NSMutableDictionary* PaymentMethodSalesTotals; } @property (nonatomic, retain) NSMutableDictionary* PaymentMethodSalesTotals; @end The class.m file is like this ...

Adding NSMutableDictonary to NSMutableArray but objects being replaced

How come whenever I add a new object NSMutableDictionay to my NSMutableArray it replaces my previous object? For example: [appDelegate.tracksDict setObject:currentTrackTitle forKey:@"track_title"]; [appDelegate.tracksDict setObject:currentTrackTopic forKey:@"topic"]; [appDelegate.tracksArray addObject:[appDelegate.tracksDict copy]]; ...

NSMutableDictionary not taking key/value pair

Hi all, so here I am stuck at the simplest part (or so I thought) of my small project for this morning. The goal was to build a simple XML Parser who takes every element they encounter and add it to a dictionary that will eventually hold all key/value pairs of the xml. So an xml like this <xml> <1stTag>text</1stTag> <2ndTag>some m...

looping through an NSMutableDictionary

How do I loop through all objects in a NSMutableDictionary regardless of the keys? ...