nsdictionary

NSDictionary objectForKey answere randomly

Hi everyone, I have a NSMutableDictionary, and my keys are objects (and the class implement the NSCopying protocol). I add a value in the dictionary associated to a key, then, when I call the objectFoKey: method for the key which is in the dictionary, randomly, sometimes the method call "isEqual" and the key is found, and sometimes, th...

Deserialize an object from an NSDictionary from TouchJSON?

I can't seem to work out how to get a Dictionary representing an object from the dictionary that TouchJSON returns. For example: If I use the JSON in the format here: http://search.twitter.com/search.json?q=hello How would I get a tweet with the "id" = x without having to pull all of the tweets into an array using a "for" statement? ...

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

Adding NSArray to NSDictionary is causing problems

Hi, I'm writing an app in XCode 3.2.3 for iOS 4. In my code, I am creating an NSArray of NSDictionaries, each containing two key/value pairs, a string and an NSArray of NSDictionaries (kind of confusing, I know). Just to give you a visual, here is the structure: <NSArray> <NSDictionary> <NSString/> <NSArray> ...

iPhone: Missing method? NSDictionary dictionaryWithData:

A web service provides data in the form of a plist. After the download, I have all of the data in an NSData object, which I want to convert to an NSDictionary. Right now the only way I know of to do that without parsing it by hand (yuck) is this: static NSString *fileName = @"tempFile"; [data writeToFile: fileName atomically: NO]; NSD...

storing adressbook contacts into a nsdictionary

hi, i'm still trying to wrap my head around using NSDictionaries, and have come into a situation where i believe i need to use one. essentially, i would like to store all the phone numbers associated with each contact into a dictionary. so far i have this: ABAddressBookRef addressBook = ABAddressBookCreate(); NSArray *thePeople = (NSA...

Creating an NSManagedObject with NSDictionary contents

I want to create an NSManagedObject with the contents of a NsDictionary. and Visa Versa. I have a NSDictionary with object and keys that is being brought in from a MYSQL database and stored to the documents directory. I can't find good info for editing a dictionary so I thought I would try NSManaged Object instead. If the Object attri...

how to access an NSDictionary through an ordered NSArray

So I have an NSDictionary that contains several objects with properties (key:values), but the issue is that I need them in a specific order. Stored as an NSArray is a list of objects that I would like to use as keys for the NSDictionary. I can output the NSArray and NSDictionary to the Console, however when I to access each of the valu...

Key Value Bindings iPhone

I have a bunch of NSDictionaries thats stored in an NSArray. The dictionaries store coordinates for buttons, their name, and their relating object to load when pressed (UIView). When the button is pressed I can retrieve which button it is in string format, for example "settings" and I would like to then run the object -(void)settings{}....

Sorting an NSArray by an NSDictionary value

I'm trying to sort an array that would look something like this: (please ignore the fact these people are well past any living age! I just needed large numbers) NSDictionary *person1 = [NSDictionary dictionaryWithObjectsAndKeys:@"sam",@"name",@"28.00",@"age",nil]; NSDictionary *person2 = [NSDictionary dictionaryWithObjectsAndKeys:@"cody...

How to create an NSDictionary with two values per key from plist

I have a dependent UIPicker that loads the values into its two components from a plist. It's an NSDictionary with NSArrays of strings. The user selects a pair of components and the picker sends those two strings back to the delegate. What I really need is a constant that goes along with each individual choice. For example, first comp...

how to iterate nested dictionaries in objective-c iphone sdk

Hi I have a json string converted unsing the JSON framework into a dictionary and I need to extract its content. How could I iterate to the nested dictionaries? I have already this code that allows me to see the dictionary: NSDictionary *results = [responseString JSONValue]; NSMutableArray *catArray = [NSMutableArray array]; for (id k...

multi-section UITableView issues

Hi, I have an UITableView that contains 3 NSArrays and 3 NSDictionaries for each array. - (void)viewDidLoad { [super viewDidLoad]; contentArray = [[NSMutableArray alloc] init]; self.settingsArray = [NSArray arrayWithObjects:@"Settings", nil]; NSDictionary *settingsDict = [NSDictionary dictionaryWithObject:settings...

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

NSDictionary losing its contents (exc bad access)

Hi So i have a uiviewcontroller. It has a property of an NSMutableArray with a nonatomic, retain property synthesized. In the viewDidLoad I init it with the following, and also add a button to the nav bar. test = [NSDictionary dictionaryWithObjectsAndKeys: [[SearchField alloc] initWithName:@"Subject" :Text], kSubjectKey, ...

Help w/ array of dictionaries in a tableview

This is kinda confusing so please bear with me. I have an array (listOfStates) of dictionaries. Where listOfStates has this structure: {stateName} - {stateCapital} {Alabama} - {Montgomery} {Alaska} - {Juneau} {Arizona} - {Phoenix} ... {West Virginia} - {Charleston} {Wisconsin} - {Madison} {Wyoming} - {Cheyenne} This is the code used ...

Objective-C Storing Information

Hello, in an iPhone app, the User can create Items - each Item needs to have a CGPoint, NSString and a few integers with information about it. The User can keep adding these Items. How can i store all these variables for each of the Items and programmatically keep adding them to a list or array or something? I tried using a struct arr...

Populating two grouped tableviews from the same PLIST

In my app, there is a portion that holds a static contacts directory. I would like the directory to appear indexed (alphabetically) and the detail view will need to be grouped also. (I am somewhat trying to replicate the look and feel of the Contacts app.) I have it working, just no index and a detail page that is just a view with a col...

Insert NSDictionary

hi, I have a question. If i have a NSArray i can put into a NSDictionary? If i can, how can do these? Thanks ...

How do I get the value's of name & url from a nsdictionary object?

So i'm using touch JSON which worked out pretty well for me. I was able to take an array, put it in a dictionary, serialize it via touchJSON and send it out via http. now on the return end, i received the data, and put it into a dictionary (i'm using trends.json from twitter as an example JSON). now if i try to get the value for tren...