I'm suffering from a bad memory leak parsing one of my xml documents.
I'm using the NSXMLParser to iterate each node (album in the xml sample below), then iterate each photo node and add the result to an NSArray.
I have 2 retained properties, which store two values on each loop. These values are added to a NSMutableDictionary object a...
Is there any downside to using NSSet as key in NSMutableDictionary, any gotchas to be aware of, any huge performance hits?
I think keys are copied in Cocoa containers, does it mean NSSet is copied to dictionary? Or is there some optimization that retains the NSSet in this case?
Related to http://stackoverflow.com/questions/1863061/can-...
Hi all,
I'm having difficulty to add a data structure to an array to create an array of dictionaries from a loop. I just knew that addObject in NSMutableArray only add pointer to it. I would like to know how to achieve my goal.
Here's my code:
NSMutableDictionary *woRows = [[NSMutableDictionary alloc] init];
NSMutableArray *workOrders...
I have a question on thread safety while using NSMutableDictionary
Main thread is reading data from NSMutableDictionary
where
key is Nsstring
value is UIImage
Async thread is writing data to above dictionary (using NSOperationQueue)
how do I make above dictionary thread safe
Should I make Property NSMutableDictionary as "Atomic" or ...
I'm currently doing the following to clear out an NSMutableDictionary
[myDictionary release];
myDictionary = [[NSMutableDictionary alloc] init];
The release line doesn't actually release any objects in the dictionary. I can still see all of them on the next line. It isn't until the alloc line is executed that the dictionary is zeroed...
What's the best way to handle Boolean values that derive from a UISwitch setting, and are stored in an NSMutableDictionary that is saved to the user's directory as persistent settings? Specifically, what's the best way to keep boolean values distinct from numeric values in an NSMutableDictionary that gets written to and read from the fil...
I am newbie to Iphone Application development. Please help me. I am sorry if I am wrong. I have following declarations:
//.h file:
NSMutableArray *dataArray;
NSMutableDictionary *item;
//.m file
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedN...
I know you could add all the keys to an array and add it to one side of the dictionary but I'm curious how you can add or insert a value at a certain point in the dictionary. The way i have it now it I believe it just keeps overwriting the last entries to make room for the new one:
NSMutableDictionary *bookmarks = [[NSMutableDictionary ...
I'm storing a bunch of data in a .plist file (in the application documents folder), and it's structured like this:
Dictionary {
"description" = "String Value",
"sections" = Array (
Array (
Number,
...
Number
),
Array (
Number,
...
Num...
I am finding some difficulty in accessing mutable dictionary keys and values in Objective-C.
Suppose I have this:
NSMutableDictionary *xyz=[[NSMutableDictionary alloc] init];
I can set keys and values. Now, I just want to access each key and value, but I don't know the number of keys set.
In PHP it is very easy, something as follows...
Someone in that forum proposed me a code solution that worked great, but for my understanding, I would like to know what is the difference between the 2 blocks of code:
Block 1
NSMutableDictionary* step_info = [NSMutableDictionary dictionary];
Block 2
NSMutableDictionary* step_info = nil;
step_info = [NSMutableDictionary dictionary]...
I am parsing a data file and adding the key-value read from the file into an NSMutableDictionary.
I have noticed that when I print out the content of the dictionary in the debugger, i.e:
po myDictionary
some entries have quotes around them and some don't. Why is this?
For instance I see:
{
"file_path" = "../dat.txt"
anot...
for(NSString *s in mainarr)
{
NSString newseparator = @"=";
NSArray *subarray = [s componentsSeparatedByString : newseparator];
//Copying the elements of array into key and object string variables
NSString *key = [subarray objectAtIndex:0];
NSLog(@"%@",key);
NSString *class_name= [subarray objectAtIndex:1]; ...
I have an NSMutableDictionary.
NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:path];
I have to update an element in that dictionary. How i can do that ? Thanks in advance
...
I have a plist. It has several dozen keys, each with NSMutableArray items:
...
<key>KeyName1</key>
<array>
<string>String1</string>
<string>String2</string>
<string>String3</string>
</array>
<key>KeyName2</key>
<array>
<string>String1</string>
<string>String2</string>
<string>String3</string>
</array>
...
I ha...
Hello,
I'm maintaining a NSMutableDictionary which holds key and value pair.Now i need to perform some operation for each value in it.How to retrive value from dictionary.
// this is NSMutableDIctionary
NSMutableDictionary *dictobj = [[NSMutableDictionary alloc]init];
// in methodA
-(void)methodA
{
//get the value for each key and...
When my app starts, it loops through adding values of random numbers with keys of co-ordinates on a grid to a dictionary. Here is a bit of the code:
[grid setObject:v forKey:k];
K is a string in form "xy" where x and y are single digit integers and V is an NSNumber. Both of these are logged to the console before adding so I know these...
Hi! Help me please with the following problem:
- (NSDictionary *)getGamesList
{
NSMutableDictionary *gamesDictionary = [[NSMutableDictionary dictionary] retain];
// I was trying to change this on the commented code below, but did have no effect
// NSMutableDictionary *gamesDictionary = [[NSMutableDictionary alloc] init];
// [g...
All objects used as keys in NS(Mutable)Dictionaries must support the NSCopying protocol, and those objects are copied when they're used in the dictionary.
I frequently want to use heavier weight objects as keys, simply to map one object to another. What I really mean when I do that is effectively:
[dictionary setObject:someObject forKe...
Hey there,
i have a problem with a exc bad access. I already turned in NSZombieEnabled, but cannot figure out why this problem will be caused.
How the cartInstance Array is defined you can see below in the following function.
It's a NSMutableArray with several NSMutableDictionaries
The error occurs every time my counter i reaches 13.
The...