nsmutablearray

How to get all the contents of Hashtable and put into NSMutableArray?

hello, How to get all the contents of Hashtable[NSMutableDictionary] into NSMutableArray , which is to be done for iPhone application? ...

NSArray - check if objects are in an array?

I have 2 arrays. One is a large static group of 600 objects, the other is a small varying group of 10 objects. I want to take any common objects between the two groups and put them in a new array. So lets say the large group contains 600 objects named 1 to 600. The smaller group contains 9 objects: 1, 2, 3, 4, 5, 6, a, b, c. I want to ...

NSArray question - \n\t\t being added to the end of strings?

My strings are fine, but when they get added to an array a weird grouping of "\n\t\t" gets added to the end. So the string "Apple", becomes "Apple\n\t\t" when I look at the array description. Whats the deal with that? and how do I fix it? Addition: Its XML code. It seemed like [currentPlace appendString:string]; would get the right pa...

What is the KVC Search Pattern for mutableArrayValueForKey?

Hello! I'm attempting to understand Cocoa's Key-Value Coding (KVC) mechanism a little better. I've read Apple's Key-Value Programming Guide but am still a little confused about how certain KVC methods search for keys. Particularly, mutableArrayValueForKey:. Below I'm going to explain how I understand valueForKey: KVC "getters" to wor...

How to sort a mutable array with reference to Date which is saved as "object for key" in iphone?

I am new to iphone development .I have mutable array recent in which the values such as title,date,url and summary are stored as " object for key".The keys are myurl,mudate,mytitle,mysummary.I want to sort that mutable array in reference to date and print all the values according to that..How can i achieve that?Please help me out.Thanks....

Fast Enumeration With an NSMutableArray that holds an NSDictionary

Is it possible to use fast enumeration with an NSArray that contains an NSDictionary? I'm running through some Objective C tutorials, and the following code kicks the console into GDB mode NSMutableArray *myObjects = [NSMutableArray array]; NSArray *theObjects = [NSArray arrayWithObjects:@"easy as 1",@"easy as two", @"Easy as Three"]; ...

How to avoid "NSInternalInconsistencyException" in iphone?

I am new to iphone development.I am sorting an mutable array. For sorting NSSortDescriptor *descriptor = [[NSSortDescriptor alloc] initWithKey:@"pubDate" ascending:NO]; [recent sortUsingDescriptors:[NSArray arrayWithObjects:descriptor, nil]]; recent1 = [recent sortedArrayUsingDescriptors:descriptor]; [descriptor release]; I am gett...

The correct way to declare, alloc, load, and dealloc an NSMutableArray

I declare my array in my *.h file: @interface aViewController: UIViewController { NSMutableArray *anArray; // You will need to later change this many times. } @end I alloc memory for it my *.m file: -(void) viewDidLoad { anArray = [[NSMutableArray alloc] init]; } I click a test-button to load my array (eventually it will...

Releasing an Array Object.

According to Instruments analysis, I have a memory leak here - and - I'm unsure as to how to properly release the scoresArray object that I have created. This code does work properly, apart from the leakage. I release the highScoresArray object later in the code - but attempts to release the scoresArray kill the app. I thought that whe...

How do I get String value out of NSMutableArray

Code: [self.menuList addObject:[NSDictionary dictionaryWithObjectsAndKeys: NSLocalizedString(@"PropertySubtype2fTitle", @""), kTitleKey, publishNoOfRoomsViewController, kViewContro...

How to check Object At Index in NSMutableArray

Hi, I have a NSMutableArray, I want to insert data inside it, the problem is first I wanna check if the index where I'm inserting the data exist or not, but how to do that. I try something like that but nothing is working: if ([[eventArray objectAtIndex:j] count] == 0) or if (![eventArray objectAtIndex:j]) Thanks, ...

number of elements in NSMutableArray

How to know at runtime how many array elements are there in NSMutableArray? ...

Objects not being added to NSMutableArray Objective -C

Hi, I'm trying to simply add objects to a mutable array but they WILL NOT insert. I'm not getting errors or anything and I can't figure out whats going on. In my main delegate file I split an array into 4 separate strings like so. NSArray *split=[currentParsedCharacterData componentsSeparatedByString:@"|"]; NSLog([split object...

iPhone NSMutableArray Memory Leak

Xcode Instruments claims that the below code results in memory leak. As far as I understand, the following happens when assigning a property: * The old value is autoreleased * The new value is retained * The new value is assigned obviously With that it mind, how come I have a memory leak and how do I resolve it? "TestProjectViewContro...

How do I set an array with another Array?

@property (nonatomic, retain) NSMutableArray *filteredListContent; ---- @synthesize filteredListContent; - (void)applicationDidFinishLaunching:(UIApplication *)application { NSMutableArray *test = [[NSMutableArray alloc] init]; [test addObject:@"test string"]; [filteredListContent addObjectsFromArray:test]; N...

Archive a NSMutableArray

I need to archive a NSMutableArray which is being controlled by an ArrayController. I tried this: [NSKeyedArchiver archivedDataWithRootObject:array]; But I got this error: *** -[NSKeyedArchiver dealloc]: warning: NSKeyedArchiver deallocated without having had -finishEncoding called on it. How may I solve that please? ...

Problem working with NSMutableArray to store objects other than just strings in UITableViewController

I am a novice using iPhone SDK and Objective C. I am facing a stupid issue with the NSMutableArray object. I have a Team class and a Player class. Team class has an NSMutableArray object that holds the Player objects. Team class is initialized with initWithTitle:(NSString*)title constructor. Player has Name property. Now, I have a simp...

Objective-C: changing object inside NSMutableArray

In my program I have two classes: Collector and Entity. Collector stores Entities in NSMutableArray. @interface Entity : NSObject { ... } @interface Collector : NSObject { NSMutableArray *entities; uint someInt; ... } - (void)addEntity:(Entity*)newEntity; // implemented as [entities addObject:newEntity]; Collectors ...

iPhone SDK Core Data or a 2D Array

I have a data set that is around 700 rows with eight columns of string data. Is it worth setting up core data? Will I see a huge performance difference if between Core Data and an array? The app is a simple UITableView and and a couple of drill down style detail views. I will be searching the data set on one of detail views. ...

"-[CFNumber intValue]: message sent to deallocated instance" and no idea

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...