nsdictionary

How should I construct an NSDictionary with multiple keys?

I have a situation where I want to map a pair of objects to a dictionary of information. I'd like to avoid creating an NSDictionary of NSDictionaries of NSDictionaries since that's simply confusing and difficult to maintain. For instance if I have two classes, Foo and Bar, I want {Foo, Bar} -> {NSDictionary} Are there other options th...

NSDictionaryController doesn't seem to observe changes to content dictionary

I must be missing something simple, but I am having some trouble binding a tableView to an NSDictionaryController. Here is a model of my current scheme: TableViewColumn --bindsTo-->DictionaryController.arrangedObjects.(value or key) --bindsTo-->someClass.someClassMember.aDictionary. I've tested the tableView by adding a...

A question on how to Get data from plist & how should it be layout.

This is a follow up question on my first queries regarding retrieving data on plist. Right now i have manage to detect users touches made on my view with random image call out (thanks to phytonquick). CGPoint currentTouchLocation = [currentTouch locationInView:self]; Im having trouble now on how to compare the value i got from the use...

Updating & changing settings plist files with new versions of an app

Hi there, I've got a default settings plist file in the resources folder of my app, and on the first launch that gets copied to the documents folder. In successive versions of the app, how can I merge the plist settings in their documents with any new keys & values (possibly nested) that have been added since the previous version? I'v...

Objective-C NSDictionary value comparison

I am returning a string of either T or F from an NSDictionary key value pair. I'm trying to find out if it is the T or the F, but it never works like I would expect it to. I'm sure there is a very basic solution for this issue. if ([game objectForKey:@"complete"] == @"T") never evaluates to true. ...

Parse Query String into a Structured NSDictionary

I have a query string: a=1&b=2&c[1]=3&c[2]=4 etc… I want a NSDictionary where a => 1, b => 2, c => [3,4]. Notice that that the value for c is an array. It should also be able to handle something like c[1][2]=5 to make an array of arrays c => [[5]]. Of course I can do it myself by splitting on the & and =, but what about other cases s...

Passing an NSDictionary to a ViewController from AppDelegate

This is related to a question I asked earlier, but the original question was answered. Hope it's okay to open a new question, if not, feel free to delete it. I'm trying to build a simple iPhone application using tableviews and a tabbar. Every view is the same programmatically, except for the title and the kind of data which needs to be ...

Extract or show some dictionaries for sequenced TableView

In a Tabbar app, I have a TableView to show all names of each dictionary of an array coming from an array like this : <array> <dict> <key>Name</key> <string>Name1</string> <key>CategoryA</key> <string>CategoryA1</string> <key>CategoryB</key> <string>CategoryB4</string> <key>CategoryC</key> <string>CategoryC8</string> </dict> <di...

How can we store into an NSDictionary? What is the difference between NSDictionary and NSMutableDictionary?

I am developing an application in which i want to use an NSDictionary. Can anyone please send me a sample code explaining the procedure how to use an NSDictionary to store Data with a perfect example? ...

Creating an Array of Arrays in XCode

I am trying to build an array that contains arrays of dictionary objects in Xcode. I can create a working array that has one or more dictionaries in it and then use the addObject: method to add this array as an object in my main array. I cycle around this several times, rebuilding the working array and adding objects to the main array....

Replacement for use of nil in dictionaries in objective-C

Hey stackfolk, I'm working in the IPhone SDK, and am pretty new to objective-c. Right now I'm working with NSUserDefaults to save and restore setting on my IPhone app. In order to save the classes that have been created, I encode them into dictionary form, and then save the NSdictionary. My problem is that I can't find a reasonable w...

AppDelegate Being accessed from different classes, from RootController.m

Hi All, My problem is in getting the information from a controller(which happens to be my rootViewController) to another view. In trying to get access to it through the app delegate, I was not able to get it working. I have found how to do this, but this inturn created another problem of getting the view inside a modal view controller t...

Problem reading a string from an NSDictionary inside an NSMutableArray stored using NSKeyedArchiver.

I'm saving some data using a series of NSDictionaries, stored in an NSMutableArray and archived using NSKeyedArchiver. I'm basically trying to save the states of several instances the class 'Brick', so I've implemented a getBlueprint method like this (slimmed down version) -(id)getBlueprint { // NOTE: brickColor is a string NSD...

NSNull crashes my initWithDictionary

I am parsing a JSON file. After getting the NSDictionary, I parse the objects in the dictionary into an array of objects. However, for certain JSON files, I get NULL, which should be fine, but it crashes my app for those place where I am expecting something but getting null: - (id)initWithDictionary:(NSDictionary *)boxDictionary { if ...

Can't get NSTableView to display data.

Hi! I see there are a lot of questions about this, but nothing helped me to get this work. I have a nib with a NSTableView with three columns (with the right identifiers set) and a class named ShortcutsTableController. In the nib I have a NSObject with class value ShortcutsTableController. I also connected the NSTableView to my controlle...

Parsing Search Result with MGTwitterEngine in Objective C

Hi, I'm using Matt Gemmell's amazing MGTwitterEngine for an iPhone project, and my lack of familiarity with Obj-C and JSON parsing is making a simple job seem rather daunting. I've read this link, and while it helps me understand how the data is structured, I still can't seem to be able to parse it. If I do an NSLog of the output of g...

Cocoa: Any downside to using NSSet as key in NSMutableDictionary?

Is there any downside to using NSSet as key in NSMutableDictionary, any gotchas to be aware of, any huge performance hits? I think keys are copied in Cocoa containers, does it mean NSSet is copied to dictionary? Or is there some optimization that retains the NSSet in this case? Related to http://stackoverflow.com/questions/1863061/can-...

trying to display a key from an array of dictionaries in a detail view (tableview).

I have an array of dictionaries with each dictionary holding keys that store information about local places (name, address, vibe, facilities, etc.) . I have a tableview that is sorted according to the name, but I can't seem to get the detail view to view correctly. Here is a sample of the code I am trying to do to display the address inf...

iPhone SDK NSDictionary and NSArray confusion

I have been trying to get this to work for about three solid days and get my mind around it. Can someone advise. I have built the basics and they all work great but when I try to do that extra bit I cannot get my head around it. I am trying to build a table of technical terms, from a plist. This is an indexed and sections table by the al...

Need help with iphone sdk: not correctly saving .plist to documents directory

I've been spending way too long trying to figure out what is going wrong, so I hope someone her can help me out. My Code: - (IBAction)fedDog { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *path = [documen...