nsmutablearray

NSMutableArray values becoming "invalid"

Hi all, I'm trying to show a database information in a tableview and then the datailed information in a view my problem is as follow: I created a NSMutable array: NSMutableArray *myArray = [[NSMutableArray alloc]init]; Then I populated it form a database MyObj *obj = [[MyObj alloc]initWithName:idObj]; When I show the values in the ta...

Thread-safe NSMutableArray question

I am developing a RSS reader which uses a NSMutableArray (_stories) to store the contents of the RSS Feed. This array is being used by two different threads in the application and may be accessed simultaneously in two occasions, since: It is the data-source of the UITableViewController (which reads it's content and shows the desired in...

out of scope - NSMutableArray error

data = [[NSMutableArray arrayWithCapacity:numISF]init]; count = 0; while (count <= numISF) { [data addObject:[[rouge_col_data alloc]init]]; count++; } When I step through the while loop, each object in the data array is 'out of scope' rouge col data 's implementation looks like this.. @implementation rouge_col_data @synthe...

Trim file extension UITableView

I want to trim the file extension from text I have NSMutableArray'd in table cells. NSMutableArray *theFiles; NSFileManager *manager = [NSFileManager defaultManager]; NSArray *fileList = [manager directoryContentsAtPath:@"/Test"]; for (NSString *s in fileList){ theFiles = fileList; } cell.textLabel.text = [theFiles obje...

NSMutable array invalid after objectAtIndex

@implementation Level @synthesize doors, rooms; - (id) init { self = [super init]; if (self != nil) { rooms = [[NSMutableArray alloc] init]; doors = [[NSMutableArray alloc] init]; } return self; } - (void)generate{ int room_count = 2; Room *room; for (int i=0; i<room_count; i++) { room = [[Room al...

Disadvantage of using NSMutableArray vs NSArray?

I'm using an array to store cached objects loaded from a database in my iPhone app, and was wondering: are there any significant disadvantages to using NSMutableArray that I should know of? edit: I know that NSMutableArray can be modified, but I'm looking for specific reasons (performance, etc..) why one would use NSArray instead. I ass...

Difference between CFMutableArray and NSMutableArray ?

What is the difference between NSMutableArray and CFMutableArray? In which case(s) should we use one or the other? ...

Saving to Core Data with NSMutableArray

Hi all! Been having a bit of a headache with this one and was wondering if someone could offer some advice! Im implementing persistent storage with Core Data. I have two Entities Car and Driver. A car can have many drivers. In one view i am collecting the drivers and storing them to a NSMutableArray This array is getting passed to...

How can I edit a mutable property in Objective C?

Hello. I am trying to edit a mutable array from a property and can't seem to directly make it work. Consider the following code that seems to work, but seems also very inefficient; I have to copy the whole property array just to make a change in one object. Why can I change the whole "carNames" array, but can't make a change to one...

Creating an Array of Arrays in XCode

I am trying to build an array that contains arrays of dictionary objects in Xcode. I can create a working array that has one or more dictionaries in it and then use the addObject: method to add this array as an object in my main array. I cycle around this several times, rebuilding the working array and adding objects to the main array....

How to split an NSArray into two equal pieces?

I have an NSArray, and I want to split it into two equal pieces (if odd "count" then add to the latter new array) - I want to split it "down the middle" so to speak. The following code does exactly what I want, but is there a better way?: // NOTE: `NSArray testableArray` is an NSArray of objects from a class defined elsewhere; NSMuta...

problem while accesing mutable array value

Hi I am new to this objective c I have created the one mutable array in appdelegate. I am trying to retrieve values of that mutable array in another app. But it is crashing at that point. below is the code i have declared in appdelegate savedLocation = [[NSMutableArray alloc] init]; savedLocation = [[NSMutableArray arrayWithObjects:...

Objectiv C: how to check if variable is nsarray or nsmutablearray

Hello, how can i check a variable is NSArray or NSMutableArray??? Thanks ...

How to fill one UItableViewCell with odd and even entries from an NSMutableArray?

I have an uitableview with UITableViewCellSTyleValue1 so i have a textlabel and a detail text label. The second thing i've got is a NSMutableArray. Now i want to fill the textLabels with the even items and the detailTextlabels with the odd entries. So for example cell one(zero) gets entry 0 and 1 cell one gets 2 and 3 and so on. I did...

Problem reading a string from an NSDictionary inside an NSMutableArray stored using NSKeyedArchiver.

I'm saving some data using a series of NSDictionaries, stored in an NSMutableArray and archived using NSKeyedArchiver. I'm basically trying to save the states of several instances the class 'Brick', so I've implemented a getBlueprint method like this (slimmed down version) -(id)getBlueprint { // NOTE: brickColor is a string NSD...

Access NSMutableArray to an index with no value

Hello, if i try to access a nsmutableArray with objectAtIndex:x and if i have no object at this index, my app always crash. So my question is: how can i check, if there is something at this index, without crashing the app? I hope your understand my question. Thanks, Alex ...

NSMutableArray addObject not working

I have declared an NSMutableArray *categories in my view controller .h file, and declared a property for it. In the parser:foundCharacters: method of the NSXMLParser delegate in my .m file, I have this code: -(void)parser:(NSXMLParser *) parser foundCharacters:(NSString *)string { if (elementFound) { element = ...

how to create array string

hi all, i'm having NSMutableArray which containing student info, now i just want to extract student name and their average mark only, so what i did NSMutableArray *stuCollection = [[NSMutableArray alloc] initWithCapacity:[students count]]; for (int i = 0; i < [students count]; i++) { if([students objectAtIndex:i] != NULL) { N...

UITableView using NSMutableArray to display dynamic content

Been looking for a solution for a long while now, but still no success, perhaps someone here can help me. I created an application that runs a thread that communicates with a webserver in the background. Occasionally the thread receives information that I'd like to display in a UITableView. Because of the dynamic nature of the content I...

How to sort NSMutableArray using sortedArrayUsingDescriptors ?

Hi, I have a question about sorting NSMutableArray. I can use sortedArrayUsingDescriptors: method to sort an array with objects. For example I have an NSMutableArray of places where I have an attribute frequency (int value) and I want to sort descending on frequency but I don't now if I how to use it correctly. What do I put as a k...