nsmutablearray

NSMutableArray removing the object but then app crashes

Hey Guys, I have what I think is a weird error but of course i'm relatively new to iPhone Development so it's possible that it's not all that weird after all. I have an array (NSMutableArray) of objects that I am keeping track of (one is added to the array every time the user touches a button) what I'm trying to do is when the array re...

Error when retaining NS(Mutable)Array in a class

Hi, I'm having a hard time working with arrays. Coming from AS2/AS3 and garbage collection is new to me ... ;) This is not the full code, just the parts that matter. .h-file @interface HelperViewController : UIViewController { NSMutableArray *pagesNumbers; } @property (nonatomic, retain) NSMutableArray *pagesNumbers; .m-file @syn...

NSMutableArray from filterUsingPredicate error

I am trying to return a subset of my NSMutableArray (MessageArray) with the following code. MessageArray contains an NSDictionary, one of the keys being FriendStatus. I get a strange error which I know is a DUH syntax issue. "error. void value not ignored as it ought to be". -(NSMutableArray*)FriendMessageArray { NSPredicate *pred...

Store References to Variable in NSMutableArray

Hi Everyone: I am looking for a way to store references to variables inside a NSMutableArray. As variables are going to be created dynamically based upon what the user has chosen, I want to be able to simply sort through this array and get references to these created variables. In case it matters, I am creating a iPhone project. Howe...

Difference b/w NSArray and NSMutableArray

Hi, What is the difference b/w NSArray and NSMutableArray ? i am new to iPhone. ...

How to Sort an NSMutableArray of Managed Objects through an object graph

I'm new to Apple's iPhone 3.0 SDK support of Core Data and I'm relatively new to iPhone development. My question is on slightly more "complex" sorting than is covered in the docs. I suspect that I am making an incorrect, fundamental assumption. How can I sort a pre-fetched collection of managed objects by a property contained several l...

How to do sparse array in Cocoa

I have an undetermined size for a dataset based on unique integer keys. I would like to use an NSMutableArray for fast lookup since all my keys are integer based. I want to do this. NSMutableArray* data = [NSMutableArray array]; // just create with 0 size then later people will start throwing data at me with integer indexes (all un...

NSMutableArray - Get Arrays Index Integer By Searching With A String

I have been working with NSMutableArray and have had no problems retrieving an object from an array by using objectAtIndex:int. Rather then pulling an object out of the array by an integer is their a way to get the index position by searching the array with a string. animalOptions = [[NSMutableArray alloc] init]; //Add items [animalOp...

Does NSMutableArray's -removeLastObject RELEASE the object?

I'm talking about methods like -removeAllObjects, -removeLastObject, etc for NSMutableArray. The documentation only says that these methods 'remove' the object from the array. Are the removed objects released? ...

what does -arrayWithArray actually DO?

I want to see EXACTLY how it creates an array. How can I view the .m files that show how it's done? ...

NSMutableArray addobject with malloc'd struct

I'm having trouble with a snippet of code. I'm trying to add an instance of CLLocationCoordinate2D to a NSMutable array using the addObject method, but whenever the line is executed, my app crashes. Is there anything obvious wrong with this code? The crash is on this line: [points addObject:(id)new_coordinate]; Polygon.m: #import "P...

NSMutableArray passing by parameter memory leak

Hi guys, I'm experiencing a hard issue here, would appreciate any, I mean ANY help =) I'm a experienced developer by I'm new to Objective-C/iPhone/Cocoa. I wanna create a class controller which I'm able to pass a NSMutableArray as a parameter. Then, we have: selTimeIntController = [[SingleSelectPickerViewController alloc] initWithSet...

Can I shift the objects in a NSMutableArray without creating a temporary array?

I thought I had it with, void shiftArray(NSMutableArray *mutableArray, NSUInteger shift) { for (NSUInteger i = 0; i < [mutableArray count]; i++) { NSUInteger newIndex = (i + shift) % [mutableArray count]; [mutableArray exchangeObjectAtIndex:i withObjectAtIndex:newIndex]; } } which turns 0,1,2,3,4 into 0,2,3,4,1 when I shift by o...

Need help with adding a row to a table

I am new to objective-C and I'm having a lot of trouble trying to add new rows to a table. The way it is suppose to work is, when the app loads an alert pops up asking the user if they would like to, start a new configuration, load a saved configuration, or resume the last configuration. Now if they select start a new configuration, th...

How do I create an Objective-C dictionary of arrays without reusing the same array?

Long time Windows developer, 1st time Objective-C/iPhone developer wants to create a dictionary of arrays that can be displayed in a plain TableView with alphabetic sections. The source for this dictionary of arrays is an array containing store names sorted alphabetically: Apple Store Atlanta Bread Company Borders Build-A-Bear Workshop...

NSMutableArray replace with another NSMutableArray

im trying to replace an object inside a nsmutablearrayA (self) with another nsmutablearrayB, but someone when i tried to access the nsmutablearrayB inside of my nsmutablearrayA (self), it returns nil. i have no idea why it returns nil, here is my code. I have a nsmutablearray, each contents one UIImage object. NSMutableArray *tempStor...

SQLite3 with NSMutableArray

In my app the user will be able to make/load configurations and each configuration is made up of NSStrings and BOOL values. I need to be able to store the users configurations into a NSMutableArray (there is no set limit to how many rows can be in the array) and store that NSMutableArray into a database. I don't know enough about obj-c ...

Recursive method in objective-c problem with NSMutableArray

I'm trying to create a recursive method that moves throw a NSMutableArray, something is happening that the code stays inside the loop or makes it only once. Here is my code: - (NSMutableArray* )solve:(NSMutableArray* )temp{ //just a counter int count =0; int index =0; if (count==0) { //Calculates the diffe...

Problem getting selected row index in NSTableView with filter predicate

Hi, I'm not sure I'm phrasing this properly, but basically I do this in my main app delegate: Application *app = [[Application alloc] initWithApplication:fullPath] The Application class has an initWithApplication method that takes in the path of an app and then sets the properties for appPath, name, etc. Then I add the new "app" objec...

Adding data to 2 Sections of UITableView from SINGLE nsmutablearray

Hi guys, I wanted to know how to list data in tableView in different sections BUT from a single datasource. All examples i saw had number of arrays = number of sections. What i want is suppose I have a 3d nsmutableArray. If dArray.Id = 1 { //add to first section of UITableView } else add to Section 2 of UITableView. Its probably doo...