nsmutabledictionary

Remove duplicate from nsmutablearray containing nsdictionary

浪尽此生 提交于 2019-12-01 12:26:42
I want to remove duplicates from nsmutablearray. Array Structure :- ( { "act_end_date" = ""; "act_entry_date" = "13/11/2014"; "act_recurrrance_type" = Daily; "act_start_date" = "2014-11-13"; "row_id" = 0; "act_id" = 2; } { "act_end_date" = ""; "act_entry_date" = "13/11/2014"; "act_recurrrance_type" = Daily; "act_start_date" = "2014-11-13"; "row_id" = 1; "act_id" = 2; } { "act_end_date" = ""; "act_entry_date" = "16/11/2014"; "act_recurrrance_type" = Daily1; "act_start_date" = "2014-11-15"; "row_id" = 2; "act_id" = 3; } ) What I want is to check where array contain any dictionary which have same

Spritekit crashes when entering background

自闭症网瘾萝莉.ら 提交于 2019-12-01 03:43:21
Allright guys, I've been developing an app in which I have a NSMutableDictionary with an SKAction object in it. The SKAction is for playing a sound. This all works well, except ... the app crashes upon entering background with the following stack trace: * thread #1: tid = 0x187d7, 0x3461b932 libGPUSupportMercury.dylib`gpus_ReturnNotPermittedKillClient + 10, queue = 'com.apple.spritekit.renderQueue, stop reason = EXC_BAD_ACCESS (code=1, address=0x1) frame #0: 0x3461b932 libGPUSupportMercury.dylib`gpus_ReturnNotPermittedKillClient + 10 frame #1: 0x3461c3d0 libGPUSupportMercury.dylib

How to remove elements in NSMutableArray or NSMutableDictionary during enumeration?

筅森魡賤 提交于 2019-11-30 17:50:12
I am using block based enumeration similar to the following code: [[[rows objectForKey:self.company.coaTypeCode] objectForKey:statementType] enumerateObjectsWithOptions:NSEnumerationConcurrent usingBlock:^(id coaItem, NSUInteger idx, BOOL *stop) { // block code here }] I would like to remove some of the objects during the enumeration process depending on the their object values. How could I do this? I know that manipulating an mutable array or dictionary (NSMutableArray or NSMutableDictionary) during enumeration is usually not possible. What would be the best way to implement this? Thank you!

Filtering array of dictionaries in Swift

纵饮孤独 提交于 2019-11-30 16:02:21
I have An Array With Dictionaries example : ( { Email = "kate-bell@mac.com"; Name = "Kate Bell"; Number = "(555) 564-8583"; }, { Email = "d-higgins@mac.com"; Name = "Daniel Higgins"; Number = "555-478-7672"; } ) And i want to filter this dictionary according to Key "Name" func searchBar(searchBar: UISearchBar, textDidChange searchText: String) { let predicate = NSPredicate(format:"Name == %@", searchText) let filteredArray = (arrContact as NSMutableArray).filteredArrayUsingPredicate(predicate) print(filteredArray) if(filteredArray.count == 0){ searchActive = false; } else { searchActive = true

Filtering array of dictionaries in Swift

南楼画角 提交于 2019-11-30 14:20:44
问题 I have An Array With Dictionaries example : ( { Email = "kate-bell@mac.com"; Name = "Kate Bell"; Number = "(555) 564-8583"; }, { Email = "d-higgins@mac.com"; Name = "Daniel Higgins"; Number = "555-478-7672"; } ) And i want to filter this dictionary according to Key "Name" func searchBar(searchBar: UISearchBar, textDidChange searchText: String) { let predicate = NSPredicate(format:"Name == %@", searchText) let filteredArray = (arrContact as NSMutableArray).filteredArrayUsingPredicate(predicate

How to sort an array which contains Dictionaries?

元气小坏坏 提交于 2019-11-30 07:56:00
I have an array which contains dictionaries in it; so how can I sort the array according to dictionary key values? If every element in the array is a dictionary containing a certain key, you can sort the array using a sort descriptor. For instance, if every element is a dictionary containing a key called "name": NSSortDescriptor *sortByName = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]; NSArray *sortDescriptors = [NSArray arrayWithObject:sortByName]; NSArray *sortedArray = [array sortedArrayUsingDescriptors:sortDescriptors]; The other way to achieve this would be using

How to assign values from NSMutableDictionary to NSArray

折月煮酒 提交于 2019-11-29 18:15:55
I am doing JSON parsing and I want to show my parsed data in a UITableView . For that, I am trying to assign parsed data from NSMutableDictionary to NSArray to show in the table view but the array returns null . Here my array returns null value; NSMutableDictionary *tempDict1; NSArray *arr = [[tempDict1 valueForKey:@"rates"] componentsSeparatedByString:@";"]; code - (void)connectionDidFinishLoading:(NSURLConnection *)connection { [connection release]; NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; self.responseData = nil; // NSArray

how to write NSMutableDictionary into Plist

心不动则不痛 提交于 2019-11-29 11:53:51
can any one help me with this how to write a NSMutableDictionary into a plist.... thanks in advance.. Make sure the pList file you are writing to is located in a legal place to edit it, for example Documents in the apps sandbox. Then find the path to that location (if there is an existing pList file, it will overwrite), and use: [myDictionary writeToFile:path atomically:YES]; Write how far you are in the process, and maybe some code / error-message... [yourDict writeToFile:filePath atomically:YES]; Note that dictionary must contain plist objects (instances of NSData , NSDate , NSNumber ,

NSMutableDictionary is adding quotes to keys and values - why?

穿精又带淫゛_ 提交于 2019-11-29 11:02:25
I'm trying to add some additional key/value pairs to an NSMutableDictionary, using: Tag *tag1 = [results1 objectAtIndex:0]; [resultsDict setObject:[tag1 retrieveTextUpToDepth:1] forKey:@"image_url"]; Tag *tag2 = [results2 objectAtIndex:0]; [resultsDict setValue:[tag2 retrieveTextUpToDepth:1] forKey:@"majority"]; This adds the k/v pairs with no problem, except when I come to retrieve them, some of the values have been wrapped with double quotes: po extendedDataDictionary: "image_url" = "/images/mpsL/11727.jpeg"; majority = 3460; Both keys and values are NSStrings, with no quotes - so I'm

How to sort an array which contains Dictionaries?

家住魔仙堡 提交于 2019-11-29 10:47:09
问题 I have an array which contains dictionaries in it; so how can I sort the array according to dictionary key values? 回答1: If every element in the array is a dictionary containing a certain key, you can sort the array using a sort descriptor. For instance, if every element is a dictionary containing a key called "name": NSSortDescriptor *sortByName = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]; NSArray *sortDescriptors = [NSArray arrayWithObject:sortByName]; NSArray