nsdictionary

iPhone Address Book - Actual Addresses

I'm trying to retrieve all the addresses from the address book and display them in a tableview, but I am having trouble understanding the structure of the dictionary for which street addresses are returned. Does anyone know of a tutorial or relevant code snippet for extracting the street address(es) of contacts in the AddressBook? ...

NSDictionary: convert NSString keys to lowercase to search a string on them

Hello. I'm developing an iPhone application. I use a NSDictionary to store city's names as key, and population as value. I want to search the keys using lowercase. I've using this: NSDictionary *dict; [dict objectForKey:[[city stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]] lowercaseString]]; But...

UIView as dictionary key?

I want to have a NSDictionary that maps from UIViews to something else. However, since UIViews do not implement the NSCopying protocol, I can't use them directly as dictionary keys. ...

Best way to save to nsuserdefaults for custom class?

If I have a custom class Person which has three variables (which are propertized and synthesized): NSString* theName; float* theHeight; int theAge; Person instances are stored in an NSArray 'Group'. There is only one Group. What is the best way of storing and loading the Group in NSUserDefaults? (bearing in mind that float and int are...

Can I used [NSObject hash] to store NSView's in a dictionary?

I've read that -hash does not return the same value on different architectures. However, I don't currently see this in the docs. Is there a better way to store NSView's in a dictionary without subclassing? ...

Creating Drill-Down Detail UITableView from JSON NSDictionary

I'm have a load of trouble finding out how to do this, I want to show this in a UITableDetailView (Drill-Down style) with each item in a different cell. All of the things I've read all show how to load a single image on the detail instead of showing as a UITableView. Does the dictionary have to have "children" in order to load correctl...

Whats the maximum key length in NSDictionary?

Hey there, I'm currently working on an app which displays a bunch of files in a table, and you can add and remove them and whatsoever. To prevent duplicates in the table, I'd like to create a NSDictionary using the files full path as keys for another NSDictionary which contains all the file information, but I am a little concerned about...

Using GameKit to transfer CoreData data between iPhones, via NSDictionary

I have an application where I would like to exchange information, managed via Core Data, between two iPhones. First turning the Core Data object to an NSDictionary (something very simple that gets turned into NSData to be transferred). My CoreData has 3 string attributes, 2 image attributes that are transformables. I have looked throu...

NSDictionary inspect in debug

Hi all! I wish look inside my NSDictionary during my debug operation...what is the fastest and best way to do this?? xcode doesn't have a watch like visual studio to look the objects? thanks! ...

Why NSString says it is "Invalid", objC, IPhone?

I have a ViewController, i declare NSString *xTitle at the top in testViewController.m file when i set the xTitle=@"anytext" in viewload event; and i tap a button, it shows the UIActionsheet. i try to read xTitle in UIActionSheet's clickedButtonAtIndex. i see the xTitle's value "anytext", its ok. but when i set the xTitle from NSDic...

An Important Question About NSDictionaries

I have an NSDictionary with NSStrings Some of the valueForKey:@"Key" have no entry so it's (null) NSMutableString* addressDictionaryToString = [NSMutableString string]; // use mutable string! for (NSDictionary* item in address) { // use fast enumeration! [addressDictionaryToString appendFormat:@"%@, %@, %@, %@", [...

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

iPhone table view, using NSDictionary & plist

Hi, I'm populating a UITableView with NSDictionary and dictionaryWithContentsOfFile plist. In the plist I have 3 rows, each row has an array. I don't know what the id/index of the row will be. Under: // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSInde...

Error in JSON or writing dictionary

I'm gettin the followig error after converting JSON echo into a dictionary, * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSMutableArray insertObject:atIndex:]: attempt to insert nil object at 0' ** Call stack at first throw: Here is my JSON deserialization code, I've used this model before for ...

formatting array into plist.

I have a JSON return being formatted and saved into a plist, it looks like the following: I need it to have the following format: I'm missing something in the saving of the array so I can add the "Rows" below the Root and "Item 0, etc" under the profile, any ideas? Here is my code: NSURL *url = [NSURL URLWithString:@"http://1...

NSdictionary object in plist needs to be a array of arrays, how to convert?

I have a dictionary .plist that has a subarray in it, however during the conversion in Json in converts to an array. The item is "profile" in the image below, as you can see, it's a Dictionary, how do I turn programmatically convert into an array": I would also like the items in the dictionary to have Item 0, Item 1, etc. so it looks ...

How to store an NSArray in an NSDictionary?

I'm trying to teach myself but am struggling with how to store something like an NSArray inside an NSDictionary. Let's say hypothetically you had a NSDictionary for recipes: Let's say the NSDictionary had keys like: Spaghetti, Fettucine Alfredo, Grilled Chicken Salad And the NSDictionary had an NSArray which was simply a list of ingr...

How to add to an NSDictionary

I was using an NSMutableArray and realised that using a dictionary is a lot simpler for what I am trying to achieve. I want to save a key as an NSString and a value as an int in the dictionary. firstly , how is this done? Secondly, what is the difference between mutable and a normal dictionary? Regards. ...

False order when reading Dictionary from PList

Hi, I have a plist from which i am trying to access its animations in sequence (as defined in the PList) but when I store it in NSDictionary and then try to play animation one by one it is not playing them in sequence. e.g, int index = 0; [self playAnimation:[animTypes objectAtIndex:index++]]; [self playAnimation:[animTypes objectAt...

Is there a Cocoa equivalent of map from C++?

I really love map in C++, it's fast and easy to program. Is there anything similar in Cocoa? I know I can mix C++ and obj-c together, but I'd rather use a more obj-c way to program :) Thanks!! ...