So I stored an NSMutableArray of NSNumber objects into the file "times.plist" then I load it and retain it on launch and the NSLog shows the correct value, but later the [times count] equals 0. Why are the NSNumbers disappearing?
times = [[NSMutableArray alloc] initWithObjects:[[NSNumber alloc] initWithFloat:time],nil];
...
[times writ...
Hi Guys!
So I've been doing a lot of reading. And I have been able to finally declare an extern MutableArray and access it from different Views. I have two views:
1) Testing View Controller
2) Test2
I declare the array as follows:
TestingViewController.h
extern NSMutableArray *myArray;
#import <UIKit/UIKit.h>
@interface TestingVie...
Hi,
I´m using instruments to find memory leaks, and it found a lots!
But i don´t know how to fix it.
@property(nonatomic, retain) NSMutableArray *wycategories;
...
...
self.wycategories = [[NSMutableArray alloc]init];
...
...
for (CXMLElement *node in nodes) {
//Instruments say that here there are a lots of memory leaks
Wa...
Early warning - code sample a little long...
I have a singleton NSMutableArray that can be accessed from anywhere within my application. I want to be able to reference the NSMutableArray from multiple NIB files but bind to UI elements via NSArrayController objects. Initial creation is not a problem. I can reference the singleton NSMutab...
Hi guys,
I getting leak here which is written in the appDelegate.m
-(NSMutableArray*)getSalutationList
{
NSMutableArray *list=[[NSMutableArray alloc]init];
[list addObject:@"Dr."];
[list addObject:@"Mr."];
[list addObject:@"Mrs."];
[list addObject:@"Miss."];
[list addObject:@"Ms."];
return list; //return [...
If you have a method in objective c that builds an array or dictionary using a mutable object, should you then copy the object, or return the mutable version? This is probably a case of opinion but I have never been able to make up my mind. Here are two examples to show what I am talking about:
- (NSArray *)myMeth
{
NSMutableArray *...
Hi all,
In my aplication, I have an nsmutablearray which stores a number of types of objects. All these objects are having two similar properties: id, type.
What I'm doing is I'm fetching the current working object in a 1-element array and accessing its properties id, type from within another class. This class is not aware which type o...
Hi Guys,
These are setter and getters.
-(NSMutableArray*)contactList
{
return contactList;
}
-(void)setContactList:(NSMutableArray*) aContactList
{
[contactList release];
contactList=aContactList; //its working fine but leaks
// contactList=[aContactList copy];
// If I keep like this getting exception as mutatin...
I have the following code
NSMutableArray *plistArray = [[NSMutableArray alloc] initWithContentsOfFile:filepath];
[plistArray insertObject:title atIndex:2];
but would like to rather add the object to the end of the array.
How can this be done, and do I need to set the last value to nil, at the moment I dont and it works fine.
Regard...
I have the following code (both items and itemsCopy are NSMutableArray's):
//DO: populate items w/ 30 elements
[self.itemsCopy addObjectsFromArray:self.items];
//DO: remove all elements in items
Results
Begin Pass 1:
itemsCopy = 0
items = 30
End Pass 1:
itemsCopy = 30
items = 0
Begin Pass 2:
itemsCopy = 0
items = 30
End Pass 2:
it...
Hi,
I'm trying to work out how to move data, parsed from an RSS feed into a UITableView into an entirely new view, for example a UIMapKit, but not having much luck. Each time I get "dog.name" (see below) = null.
I have an NSMutableArray, called "Dogs". It's created in a "currentDogstableview" class - which downloads the data from an RS...
Hi Guys,
I have one doubt
NSMutableArray *array=[[NSMutableArray alloc]init];
here some memory is allocated then how can we release this memory, whether using removeAllObjects method or [array release];
Are both have same functionality?
Thank You,
Madan Mohan.
...
I've recently come to learn that NSFetchedResultsController is an extremely buggy class and its been causing me headaches for a while now with my rather large Core Data app.
Would it be appropriate to use an NSMutableArray to feed the table view instead of an NSFetchedResultsController? What I'm talking about is, temporarily creating a ...
Hi,
I would like to save objects that the user adds to a NSMutableArray that I will be able to see and use even if I quit the application.
I tried to use NSUserDefaults but I'm doing something wrong.
Thanks!
...
Hi,
I have a problem when trying to delete rows from my UITableView:
The UITableView gets the number of rows from NSMutableArray:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [alertsArray count];
}
I add objects to the NSMutableArray in this way:
- (void)saveButton:(id)sender {
[...
I currently write to and read from an array of data, and use the index of each element to achieve something. I need a way to store this array, I looked at the user defaults, but that stores a dictionary, with retieval using keys. I will not know what key was stored.
What is the best was to store ths array of data on the iphone?
Regards...
Hi,
I get the error (Lvalue required as left operand of assignment) for this code:
[[addAlertViewController alertsArray] = [NSMutableArray arrayWithObjects:nil] retain];
How can I fix it?
...
I'm trying to create a squishy ball with Cocos2d and Chipmunk (via SpaceManager) using a bunch of rects all chained together then joined with springs to a central body.
Something like these examples
But in order to do this, i think I need to store all the cpShapes in an array after I've created them so I can then loop through the arra...
I've got an array (actually a mutable array) of NSStrings, and I want to find out how many unique elements the are in the array.
For instance, say the array is made up of:
Orange, Lemon, Lemon, Orange, Lemon
Then there are just two unique elements (Orange and Lemon). And this array:
Paul, Steve, John, Harry, Paul, John
..has four ...
I am not quite sure I understand how to do the following.
If I wanted to add e.g. an author and a title (key, value) to a dictionary. Fill that dictionary with data, then have another dictionary for say e.g. k = genre v = artist name and fill it with data.
Then I want to add the dictionaries to an array.
Firstly how is that done? a...