nsmutabledictionary

How to check if the value in an NSDictionary exists in an array of dictionarys

醉酒当歌 提交于 2021-02-06 13:53:39
问题 The title is a bit confusing...I'll explain I have an NSMutableArray I am populating with NSMutableDictionary objects. What I am trying to do is before the dictionary object is added to the array, I need to check whether any of the dictionaries contain a value equal to an id that is already set. Example: Step 1: A button is clicked setting the id of an object for use in establishing a view. Step 2: Another button is pressed inside said view to save some of its contents into a dictionary, then

Can't Send NSMutableDictionary To Another Class

拟墨画扇 提交于 2020-02-24 14:10:28
问题 All, I'm trying to send the NSMutableDictionary "response" to another class of mine, or rather, have the other class pull the dictionary from this class. When the other class uses the "getResponse" method, it returns null. The code I have attached is my XML parser, which is what puts the information I need into the dictionary. At the very bottom is the method that shows "(null)" in the NSLog. I have commented it for you. EDIT: I do use the initXMLParser method to initialize in the other class

NSMutableDIctionary setObject: ForKey crashing when Key is member of Object

别来无恙 提交于 2020-01-26 01:52:57
问题 I'm trying to use an NSMutableDictionary to pair my custom classes object with a UIButton as it's key. The UIButton that is the key is also a member of the object that I want to store as the object in the NSMutableDictionary. My Class definition looks like ths: @interface ClassA : NSObject { @public UIButton *button1; UIButton *button2; UILabel *label; } @property (nonatomic, retain) UIButton *button1; @property (nonatomic, retain) UIButton *button2; @property (nonatomic, retain) UILabel

blocks in nsdictionary?

回眸只為那壹抹淺笑 提交于 2020-01-22 23:11:25
问题 So I'm storing block actions into a nsmutabledictionary and then recalling them when a response comes back on a websocket. This turns async request into a block syntax. Here's the stripped down code: - (void)sendMessage:(NSString*)message responseAction:(void (^)(id))responseAction { NSString *correlationID = (NSString*)[[message JSONValue] objectForKey:@"correlationId"]; [self.messageBlocks setObject:responseAction forKey:correlationID]; NSLog(@"Sending message: %@", correlationID);

blocks in nsdictionary?

我们两清 提交于 2020-01-22 23:07:41
问题 So I'm storing block actions into a nsmutabledictionary and then recalling them when a response comes back on a websocket. This turns async request into a block syntax. Here's the stripped down code: - (void)sendMessage:(NSString*)message responseAction:(void (^)(id))responseAction { NSString *correlationID = (NSString*)[[message JSONValue] objectForKey:@"correlationId"]; [self.messageBlocks setObject:responseAction forKey:correlationID]; NSLog(@"Sending message: %@", correlationID);

Remove duplicate from nsmutablearray containing nsdictionary

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-21 10:16:07
问题 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";

How to set object and keys to NSMutabledictionary in correct order [duplicate]

℡╲_俬逩灬. 提交于 2020-01-17 16:34:09
问题 This question already has answers here : How can i get Original order of NSDictionary/NSMutableDictionary? (5 answers) Closed 5 years ago . I am trying set objects for particular keys to an NSMutableDictionary in a for loop The code: for(int k =0;k<currenyArry.count;k++) { [_currenies setObject:@"0" forKey:currenyArry[k]]; } Here, _currenies is an NSMutableDictionary and currenyArry is an NSMutableArray . For example, currentArry is: [1,3,5,10,100,500,1000]; After setting the objects in

Filter NSMutableDictionary data in UITableView

痴心易碎 提交于 2020-01-16 20:27:06
问题 I need to filter data in UITableview by text entered in UISearchbar . I followed this example but there data in NSMutableArray and I can't alter it under my requirements. My data is NSMutableDictionary . I'm stuck on this for long time. My data: NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES); NSString *path = [[documentPaths lastObject] stringByAppendingPathComponent:@"data.plist"]; NSDictionary *dict = [NSDictionary

iOS — distinguish an NSDictionary from an NSMutableDictionary?

落爺英雄遲暮 提交于 2020-01-11 10:45:54
问题 I have the following code fragment: NSString* value = @"value"; NSString* key = @"key"; NSMutableDictionary* foo = [NSMutableDictionary dictionary]; NSDictionary* bar = [NSDictionary dictionary]; NSAssert([bar isKindOfClass: [NSMutableDictionary class]], @""); // passes the assert as both are NSCFDictionary; NSAssert([bar respondsToSelector: @selector(setValue:forKey:)], @""); // passes the assert because it NSCFDictionary does respond to the selector [foo setValue:value forKey:key]; // no

iOS — distinguish an NSDictionary from an NSMutableDictionary?

瘦欲@ 提交于 2020-01-11 10:44:05
问题 I have the following code fragment: NSString* value = @"value"; NSString* key = @"key"; NSMutableDictionary* foo = [NSMutableDictionary dictionary]; NSDictionary* bar = [NSDictionary dictionary]; NSAssert([bar isKindOfClass: [NSMutableDictionary class]], @""); // passes the assert as both are NSCFDictionary; NSAssert([bar respondsToSelector: @selector(setValue:forKey:)], @""); // passes the assert because it NSCFDictionary does respond to the selector [foo setValue:value forKey:key]; // no