nsdictionary

Updates to NSDictionary attribute in CoreData not saving

I have created an Entity in CoreData that includes a Transformable attribute type implemented as an NSDictionary. The NSDictionary attribute only contains values of a custom class. The properties of the custom class are all of type NSString. The custom class complies with NSCoding implementing: -(void)encodeWithCoder:(NSCoder*)coder;...

iPhone, trying to post a plist (NSDictionary) to a web service

Is there a simple way to package a plist object (NSDictionary, NSArray, etc.) and Post it to a web service? ...

Deleting from 2 arrays of dictionaries

I have an array of dictionaries loaded from a plist (below) called arrayHistory. <plist version="1.0"> <array> <dict> <key>item</key> <string>1</string> <key>result</key> <string>8.1</string> <key>date</key> <date>2009-12-15T19:36:59Z</date> </dict> ... </array> </plist> I filte...

How to check if an NSDictionary or NSMutableDictionary contains a key?

I need to check if an dict has a key or not. How? ...

Does array contain a specific value

Hi chaps, I have an array of nsdictionaries and one key is ID (which is unique) I simply want to see if the the array of dictionaries contains a specific ID. Really simple but its friday and after statiny up watching the election i think my brain is melting. Any help would be great. Thanks ...

Using objective-c objects with an NSDictionary

I want store a URL against a UILabel so that when a user touches the label it takes them to that URL in a UIWebView. I have declared a NSDictionary like so: NSMutableArray *linksArray = [[NSMutableArray alloc] init]; [linksArray addObject: [NSValue valueWithNonretainedObject: newsItem1ReadMoreLabel]]; [linksArray addObject: [NSValue va...

Cast an NSDictionary value while applying an NSPredicate?

Hi I have an Array of NSDictionary objects. These Dictionaries are parsed from a JSON file. All value objects in the NSDictionary are of type NSString, one key is called "distanceInMeters". I had planned on filtering these arrays using an NSPredicate, so I started out like this: NSPredicate *predicate = [NSPredicate predicateWithForm...

Add objects to NSDictionaryController

I have an NSTableView which is bound to an NSDictionaryController. I have set this and the content dictionary through the interface builder. The question I have is, how do I add objects to the dictionary in a manner that the controller will see it automatically and display it in the table. I've seen in examples about NSArrayController...

Can I refer to NSDictionary items numerically?

I'm trying to set up a UITableView which acts as a form. Each cell has within it a UILabel and a UITextField, so one cell is: Name <enter name> ^ ^ UILabel UITextField Now, I'm trying to populate the UILabel and the UITextField from a NSDictionary (from a plist), where it's organized like so: Root ...

Trouble correctly formatting NSString for JSON.

Having a little trouble processing my NSStrings into a valid JSON string. NSString *version = @"1.1"; NSString *callMethod = @"auth.login"; NSString *paramsConfig = [NSString stringWithFormat:@"{\"email\":\"%@\",\"password\":\"%@\"}", usernameString, passwordString]; int queryId = arc4random()% 10000000; NSDictionary *us...

Get String Value from NSDictionary

I have the following code: NSMutableDictionary *jsonObj = [parser objectWithString:json_string error:nil]; NSString *test = [[[jsonObj objectForKey:@"questions"] valueForKey:@"owner"] valueForKey:key]; but what I get back is: ( 1a19f089a2bc4ee42bff1c102c6e89b8 ) The actual value is fine, but I get those parenthesis, which show up ...

nested NSDictionary from plist

Hello, I have a plist, with main NSDictionary, in which its keys are dates. For every date, I have a NSDictionary in which the keys are (let's say) categories. Every Category holds Keys and values. I would like to create 2 variables that each will hold the correct NSDictionary: NSDictionary *dates = ? NSDictionary *Categories = ? Be...

Converting HTTP Response (Java "Properties" stream format) in to NSDictionary.

Hi guyz, I am working on iphone application which contains HTTP Request and Response. The format of the response is a key/value format compatible with the Java "Properties" stream format. I want to store the response into a NSDictionay. Could you suggest me any way to do this? Thank you. sangee Edit: Thanks guyz for the quick rep...

nsdictionary objectforkey - search and get that value

I'm using NSDictionary in my iphone app. I am using "objectForKey:" method to get the value of a key. One thread (first thread) is adding key-value to a dictionary and other thread (second thread) is reading them. In second thread, i want to get a value for a key which first thread some times didn't add by that time. So, in 2nd thread i ...

Help with a loop to return UIImage from possible matches

I am parsing a list of locations and would like to return a UIImage with a flag based on these locations. I have a string with the location. This can be many different locations and I would like to search this string for possible matches in an NSArray, and when there's a match, it should find the appropriate filename in an NSDictionary....

NSSortdescriptor, finding the path to the key I wish to use for sorting.

Hi I am using an NSSortdescriptor to sort a collection of NSArrays, I then came across a case where the particular NSArray to be sorted contains an NSDictionary who contains an NSDictionary. I would like to sort from the string paired with a key in the last dictionary. This is how I would reference the string: NSDictionary *productDic...

Memory leak for NSDictionary loaded by plist file

I have a memory leak problem that just can not understand! Watch this initialization method: - (id)initWithNomeCompositore:(NSString *)nomeCompositore nomeOpera:(NSString *)nomeOpera { if (self = [super init]) { NSString *pathOpere = [[NSBundle mainBundle] pathForResource:kNomeFilePlistOpere ofType:kTipoFilePlist]; NSDictionar...

What type of file do i use for NSMutableDictionary withcontentofURL?

I want to fill a NSMutableDictionary with content out of a URL File. What type file must it be and how must it be structured? NSMutableDictionary *myMutableDictionary = [[NSMutableDictionary alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://example.com/list.txt"]]; ...

How to bind a control to a singleton in Cocoa?

I have a singleton in my FTP app designed to store all of the types of servers that the app can handle, such as FTP or Amazon S3. These types are plugins which are located in the app bundle. Their path is located by applicationWillFinishLoading: and sent to the addServerType: method inside the singleton to be loaded and stored in an NSMu...

Example of [NSDictionary getObjects:andKeys:]

I couldn't find a working example of the method [NSDictionary getObjects:andKeys:]. The only example I could find, doesn't compile. I provided the errors/warnings here in case someone is searching for them. The reason I was confused is because most methods on NSDictionary return an NSArray. However, in the documentation it states that t...