nsdictionary Questions

4

Solved

I'm trying to parse an integer from a NSDictionary using the code [activeItem setData_id:[[NSString stringWithFormat:@"%@", [dict valueForKeyPath:@"data_id"]] integerValue]]; However, this is gi...
Carbuncle asked 10/4, 2014 at 23:53

5

Solved

I am trying to utilize incase-sensitive case for JSON response on NSDictionary as sometimes my response keys type varies, some are camel case, some are lowercase or other mixed combination. Is ther...
Topper asked 24/5, 2012 at 0:20

8

Solved

I have a URL coming in to the AppDelegate method: func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { } The URL looks like www...
Haskel asked 6/10, 2017 at 10:3

2

Solved

I've json data that have json string(value) that that look like this { "Label" : "NY Home1", "Value" : "{\"state\":\"NY\",\"city\":\"NY\",\"postalCode\":\"22002\",\"value\":\"Fifth Avenue1\nNY N...
Maximilien asked 26/1, 2017 at 14:41

11

Solved

Hello I a class of type NSObject: ProductDetails *details = [[ProductDetails alloc] init]; details.name = @"Soap1"; details.color = @"Red"; details.quantity = 4; I want to pass the "details" obj...
Proudlove asked 29/9, 2013 at 15:39

9

Solved

NSDictionary* fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filename error:nil] From the file attribute keys, you can get the date, size, etc. But how do you get the...
Baking asked 7/3, 2011 at 11:53

11

Solved

I need to initialize a constant HashMap and would like to do it in one line statement. Avoiding sth like this: hashMap.put("One", new Integer(1)); // adding value into HashMap hashMap.put("Two",...
Cassaundracassava asked 24/11, 2011 at 18:5

2

Solved

There are limitations with writing NSDictionaries into files in swift. Based on what I have learned from api docs and this stackoverflow answer, key types should be NSString, and value types also s...
Comp asked 29/11, 2014 at 0:39

2

I have a sample plist-file, favCities.plist. This is my sample code: override func viewDidLoad() { super.viewDidLoad() let path = NSBundle.mainBundle().pathForResource("favCities", ofType: "p...
Veto asked 11/7, 2014 at 7:55

3

Solved

I want to use the octal permissions (used for chmod) for NSFilePosixPermissions. Here is what I did now: NSFileManager *manager = [NSFileManager defaultManager]; NSDictionary *attributes; [attrib...
Ruben asked 11/3, 2012 at 13:6

3

Solved

I want to load the plist file from disk (documents, application cache, ...) not from a resource bundle.
Titled asked 18/3, 2011 at 16:1

5

Solved

In a word game for iPhone: I'm trying to use the following code in my custom view Tile.m: - (void)awakeFromNib { [super awakeFromNib]; static NSDictionary* const letterValues = @{ @"A": @1,...
Florafloral asked 20/3, 2014 at 13:19

9

Solved

I want to check if an NSDictionary is empty. I am doing it like this. mutDictValues = [[[NSUserDefaults standardUserDefaults] objectForKey:@"dicValues"]mutableCopy]; NSLog(@"dictValues are %@",m...
Pabulum asked 19/7, 2013 at 11:45

3

Solved

I've already used this method in Swift 2 var myDict: NSDictionary? if let path = NSBundle.mainBundle().pathForResource("Config", ofType: "plist") { myDict = NSDictionary(contentsOfFile: path) } ...
Stinky asked 5/11, 2016 at 10:1

6

Solved

I want to set up static dummy data, in JSON, for my app to process. This is purely client-side; I don't want to retrieve anything from the network. All the questions and answers I've seen so far h...
Vaclav asked 27/3, 2013 at 18:54

3

Solved

I have a plist file which contains an array of dictionaries. Here is one of them: Fred Dictionary Name Fred isMale [box is checked] So now I am initializing my Person object with the dictionary ...
Degradation asked 29/9, 2010 at 14:30

8

Solved

I tried to display datas which is in Dictionary format. Below, three attempts are there. First attempt, output order is completely changed. Second attempt, output order is same as input. But, in th...
Epiphragm asked 13/4, 2015 at 8:54

20

Solved

I have a simple Dictionary which is defined like: var dict : NSDictionary = [ 1 : "abc", 2 : "cde"] Now I want to add an element into this dictionary: 3 : "efg" How can I append 3 : "efg" into ...
Perineuritis asked 5/12, 2014 at 9:59

15

Solved

I'm new in Swift and I have a problem with filtering NULL values from JSON file and setting it into Dictionary. I getting JSON response from the server with null values and it crashes my app. He...
Aslam asked 20/11, 2014 at 16:4

3

Solved

Edit: I have read the other answers on SO for the same issue , however Im unable to get the desired output. I have tried many variations as suggested in other questions but its not working. I have ...
Snowflake asked 28/11, 2017 at 4:51

8

Solved

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.
Adila asked 25/10, 2010 at 3:43

4

Solved

I have an existing NSDictionary that has: { "charts_count" = 2; "created_at" = "2010-04-12T16:37:32Z"; exchange = NASDAQ; "followers_count" = 259; id = 8404; industry = "<null>"; "mes...

5

Solved

I want to use valueForKeyPath on my NSDictionary, but the problem is that one of the keys is a string that starts with the @ symbol. I have no control over the naming of the key. I'm having proble...
Homeward asked 14/10, 2009 at 17:39

14

Solved

I have a JSON Feed: { "count1" = 2; "count2" = 2; idval = 40; level = "<null>"; "logo_url" = "/assets/logos/default_logo_medium.png"; n...
Midlands asked 3/1, 2013 at 22:22

9

Is there a way via dot notation to access the values of keys in an NSDictionary like this? NSDictionary *returnVal = [NSDictionary dictionaryWithObjectsAndKeys:@"Saturn", @"name", @"Gas Giant", @"...
Bradford asked 13/2, 2012 at 16:51

© 2022 - 2025 — McMap. All rights reserved.