nsdictionary

how convert NSDictionary element to NSData (dataUsingEncoding cause crash)

Hi all, i try to convert NSDictionary element to a NSData element: ... while ((key = [enumerator nextObject])) { NSString *temp = [dictionary objectForKey:key]; if ([key isEqualToString:@"results"]) { //Crash HERE! -------------------------->>>> NSData *myData2 = [temp dataUsingE...

Getting possible dictionary key names?

How can I tell what options I have for objectForKey: calls? How do I know what values are non-null for the 'forKey' portion of the message? ...

Accessing string within an array within a plist iphone

I have a plist with root of type dictionary containing keys of type array, and each array has three items of type string. I want to access the strings and pass them to a view controller. This line is successful in my cellForRowAtIndexPath NSLog(@"Strings from plist: %@", [[self.aDictionary objectForKey:(@"%@",[self.keys objectAtIndex...

NSDictionary as property

I am getting memory leaks pointing to the line "NSDictionary *dw = [NSDictionary dictionaryWithContentsOfFile:path];" by using following code NSDictionary *_allData; @property (nonatomic, retain) NSDictionary *allData; @synthesize allData = _allData; + (NSString*)getNSPath { NSArray *paths = NSSearchPathForDirectoriesInDomains(...

Parse NSDictionary to a string with custom separators

Hey! I have an NSMutableDictionary with some values in it, and I need to join the keys and values into a string, so > name = Fred > password = cakeismyfavoritefood > email = [email protected] becomes name=Fred&password=cakeismyfavoritefood&[email protected] How can I do this? Is there a way to join NSDictionaries i...

how to remove object from NSDictionary

Hi i am having a NSdictionary in which i am adding a array with key "countries ". Now i take the value of this dictionary into array and sort the array in alpahbatical order .Now i want to add this array into my Dictionary (that is i want to update my dictionary with new sorted array and remove the old array from it ).. how to do this ...

Turning a NSDictionary into a string using blocks?

I'm sure there is a way to do this using blocks, but I cant figure it out. I want to to turn an NSDictionary into url-style string of parameters. If I have an NSDictionary which looks like this: dict = [NSDictionary dictionaryWithObjectsAndKeys:@"blue", @"color", @"large", @"size", nil]]; Then how would I turn that into a string that ...

filling uitableview with nsdictionary

hi, I have made a plist myself which picture is blow, image. keys are names of person and values are phone numbers. then I imported to source folder with ut8 encoding. Now I want to import these data to a uitableview but I'm unsuccessful. here is my codes: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath...

dictionaryWithContentsOfFile returning nil from my property list file

Hi there, I'm learning how to use plist files for storing data in my iPhone app. I've been reading a bunch of the questions about plist and dictionaryWithContentsOfFile on this site, but can't see what I'm doing wrong. The following line returns nil ("The dictionary is null" to the console). NSLog(@"The dictionary is %@",[NSDictionar...

Array with a NSDictionary doesn't want to save to the standardUserDefaults

Hello, I am having a... strange problem. I am adding an NSDictionary to an NSArray, then saving it to the defaults. When I check the object count of that key on the user defaults, it says the count is 0, but the array that's "on memory" has that object (so the count is 1). The code, along with the output it gives is this: (array is a...

Save part of NSDictionary

hi all! i have a NSDictionary with NSString and NSArray i have to save in a variable only the NSArray without know the key. Is Possibile? Thx all And sorry for my bad english ...

I need to remove double quotes from JSON for use in NSDictionary

I have a JSON return that I'm trying to save into a NSDictionary, However, Since there are spaces in the data being returned, the Dictionary won't save this array because of the quote being included. Is there a way to parse the SBJSON to remove the double quotes prior to saving to the rowsArray? rowsArray: { Rows = ( ...

Where to store a small NSArray of NSDictionaries? Not in my yard!

I have a UITableView with some login form and I manually wrote the configuration values of the UITextFields in this NSArray as NSDictionaries. It is bothering because it's data in the code. I don't want data in my code! And I think that nobody wants that. Have you ever been in this situation? How would you dispose properly of this data?...

Retrieve an object within an NSArray / NSDictionary heirarchy based on other objects within it.

Sorry about the weird title... all will be explained. Basically I have an array/dictionary structure like this in my app: NSArray { NSDictionary { (NSString *)id; (NSDictionary *)dictionary; } NSDictionary { (NSString *)id; (NSDictionary *)dictionary; } NSDictionary { (NSSt...

Unique items from a NSMutableArray with NSDictionary items?

If you have an NSMutableArray with three NSDictionarys like this: { name:steve, age:40; name:steve, age:23; name:paul, age:19 } How do I turn that into an array with just two strings { steve, paul }. In other words, the unique names from the original NSMutableArray? Is there a way to do this using blocks? ...

De-dupe NSArray of NSDictionaries based on specific keys

Hi, I am attempting to de-dupe an NSArray of NSDictionaries based on specific keys in the dictionaries. What I have looks something like this: NSDictionary *person1 = [NSDictionary dictionaryWithObjectsAndKeys:@"John", @"firstName", @"Smith", "lastName", @"7898", @"employeeID"]; NSDictionary *person2 = [NSDictionary dictionaryWithObject...

NDictionary getting autoreleased even after retain or copy

I am using following method to get back an NSDictionary object in ViewDidAppear. But when I attempt to access it in CellForRowAtIndexPath() it is always nil. I have tried adding an extra retain and copy to it, but it still gets released. I have been pulling my hair for 3 hours now. Any help would be appreciated. Excerpt : @property(...

After packaging for ad-hoc distribution, iOS app data persistence doesn't work

I just finished an app that allowed users to store lists of serial numbers in a tableview. The way the app stores the numbers is by storing in an NSMutableDictionary then writing to a persistence plist file. The app ran perfectly fine during testing. However, I just built and packaged the app for ad-hoc distribution, and now when I test...

NSDictionary - Don't Copy Values?

I am trying to manage a few animations in my scene using the following method: In a loop, create animated UIImageView, set the on stopped method. Also, store this UIImageView in a NSMutableDictionary. The animation ID is the same as the key in the dictionary. When this animation is stopped, get the animation ID. Use [animations objectF...

Deep combine NSDictionaries

I need to merge two NSDictionarys into one provided that if there are dictionaries within the dictionaries, they are also merged. More or less like jQuery's extend function. ...