nsmutablearray

NSMutableArray addObject: -[__NSArrayI addObject:]: unrecognized selector sent to instance

I have tried to initialize my NSMutableArray 100 ways from Sunday, and NOTHING is working for me. I tried setting it equal to a newly allocated and initialized NSMutableArray, just allocating, initializing the variable by itself, every combination I could think of and always the same result. Here's the code: Object.h NSMutableArray *a...

Converting NSArray to NSMutableArray

Solved after much googling. Use [arr mutableCopy]! ...

Adding objects to a NSMutableArray property

Hi guys, this is my data strucure: group [1...n] { id, name, elements : [1...n] } I define a class for element with all properties and a class for group as: @interface Group : NSObject { NSInteger groupID; NSString *groupName; NSMutableArray *elements; } @property (assign, readwrite) NSInteger g...

NSMutableArray becoming nil after reloadData

In an iPhone app I'm developing, I grab a set of data from a web service, store it in a mutable array for showing in a table, and also store it in core data as backup when there is no network. My array is initialized in application:didFinishLaunchingWithOptions: as follows tableArray = [[NSMutableArray alloc] initWithCapacity:100]; the ...

Populating an NSArray/NSMutableArray, the right way

This is a general question about memory management and best practices when using Cocoa arrays. Which of the following is "better": NSArray *pageControllers = [[NSArray alloc] initWithObjects: [[Page1 alloc] initWithNibName:@"Page1" bundle:nil], [[Page2 alloc] initWithNibName:@"Page2" bundle:nil], [[Page3 alloc] initWithNibN...

How to retrieve part of the NSString * from NSString *

Hi, everyone, I want to ask an NSString * question. I have a NSString * object. The content is like the following example. (like the CSV file) Example: (my file is longer than this one so much) First Name,Last Name,Middle Name,Phone,Chan,Tim,Man,123-456-789,Tom,,,987-654-321 (if it is empty, no space between the ',') How can I use ...

Send NSMutableArray as JSON using JSON-Framework

Hi all, I'm using JSON-Framework in my project successfully to decode JSON send from a server. Now I need to do it the other way around and I'm facing problems as the data to be sent is a NSMutableArray fetched from CoreData. When using NSString* jsonString = [menuItems JSONRepresentation] I get the message "JSON serialisation not ...

How to filter the objects of an array with another array

Hi Guys, I have one NSMutableArray with 100 objects. This is original array. I have another array that contains 20 objects which are also in the original array. I want to display the original array in the view controller minus the objects in the other array. How can I remove the existing objects from original array? we can add objec...

addObject to NSMutableArray not working for iPhone App

Hi, There have been a few threads on this topic but none have been able to solve my problem. Essentially I am trying to add a custom object to an NSMutableArray and it doesn't seem to be adding. I don't get any errors but I get a warning saying that my array is an "unused variable" so it looks like it is not getting used. See code below...

EXC_BAD_ACCESS when loading NSArray from .plist

I have a plist written from a NSMutableArray by [NSMutableArray writeToFile]. When trying to load that same plist with the following code: NSArray *testArray = [NSArray arrayWithContentsOfFile:[self pathForDataFile:@"reportingSpeicher.plist"]]; NSLog(@"count = %@",[testArray count]); I get bad access on the count or on any other opera...

How to create a 2D NSArray or NSMutableArray in objective C?

Hi, everyone, I want to ask about the objective C question. I want to create a 2D NSArray or NSMutableArray in objective C. What should I do? The object stored in the array is NSString *. Thank you very mcuh. ...

How to pass the parameters from .m to another .m in objective C

Hi, everyone, I am writing the iPhone application and I would like to ask about the the passing parameters in objective C. I create 2 view controller. In the first one, I have a button, when a user press the button, it will call the -(IBAction) pressButton (user-defined), and after 5-6 second (have to process and retrieve the data in ...

(iPhone) Reading from a web file - NSMutableArray

Right now I have an NSArray whose items are just written in the implementation file. I'd like to know how to make it so I can store all the items on a web (text) file. Example: http://mysite.com/files/objects.txt On that document: Object 0 goes here Object 1 goes here Object 2 goes here Object 3 goes here etc. All separated by ...

core data for 'add to favorites' button?

i've had difficulty finding examples/tutorials/information for this. i'd like to have an 'add to favorites' button in my application. this would take a cell from one tableview and populate that cell into the 'favorites' tableview. is core data the proper direction for approaching this? i've seen some hints about using nsmutablearray and/...

UITableView + NSMutableArray weird behavior

Hi, I'm currently trying to populate an UITableView from a plist downloaded from the internet. The plist gets loaded into a NSMutableArray and then saved as a file, which works fine. When trying to populate my UITableView with it though, I run into trouble. The UITableView displays only the first 8 entries from the *plist file (but t...

EXC_BAD_ACCESS when replaceObject called on an NSMutableArray

Hi All I am attempting to replace an object in an NSMutableArray. Elsewhere in my class I am doing it successfully. Below is an example of the code failure. NSNumber* newObject = [NSNumber numberWithDoulble:myCalculation]; NSLog(@"Old object at 12:%@",[myMisbehavingArray objectAtIndex:12]; [myMisbehavingArray replaceObjectAtIndex:12 wi...

simple NSMutable array question....

umm So simple question here: I have an instance of NSMutableArray declared in my header NSMutableArray *day19; @property (nonatomic, retain) NSMutableArray *day19 implementation: @synthesize day19; In my viewDidLoad self.day19 = [[NSMutableArray alloc] init]; In the myMethod where I want to add objects to the array I: NSObjec...

NSMutableArray - 2D array access trouble

Hi guys.. I'm having a bit of trouble accessing what I think element should be in my array. I am getting results from a webservice and trying to make sense of them. The service returns an NSMutableArray called GroupOfHouses. I have set up my code to set an array as such NSMutableArray *myHousesGroup; Then populate it myHousesGroup ...

NSMutableArray of NSStrings contains actual data or just pointers to the data

I'm relatively new to Objective C and while I've been trucking right along writing iPhone apps, I think I need some help understanding something. I'm storing a dynamic list of strings in an NSMutableArray, which is a property of my main class. In my initialization I alloc and init to store 100 items: stringList = [[NSMutableArray alloc...

how to sort an NSMutable Array reference to date in iphone

Hello All I need to sort an NSMutable Array that having a class Objects say Item . Item class have date,url,link,title,guid etc .. I am storing this Object Into an NsMutableArray each time. so MyArray will have number Of Item class Objects .. now I need to sort Myarray using date attribute . Can any one tell me the way. Thanks ...