NSMutableArray count is returning zero after adding objects to it, its been an hour of hacking away trying to figure out why, and I'm still stuck, so that brings me here.
Any ideas based off the following code, what the problem is?
the object 'search' is a custom class defined in the header set as a pointer, with retain, nonatomic attr...
I have an NSMutableArray that is populated with objects of strings. For simplicity sake we'll say that the objects are a person and each person object contains information about that person.
Thus I would have an NSMutableArray that is populated with person objects:
person.firstName
person.lastName
person.age
person.height
And so on.
...
I am having this problem with the NSMutableDictionary where the values are not coming up.
Snippets from my code look like this:
//Data into the Hash and then into an array
yellowPages = [[NSMutableArray alloc] init];
NSMutableDictionary *address1=[[NSMutableDictionary alloc] init];
[address1 setObject:@"213 Pheasant CT" forKey: @"S...
How do I get the contents of the documents directory as a NSMutableArray?
I can get it as a normal NSArray, but as soon as I try to do anything with that array, my app crashes.
Thanks
...
I found Layers that will save the project as a Photoshop file that can be edited as Photoshop, but how do I do this?
...
I need help with deallocation of my NSMutableArray of custom objects. I need to retain the array and so I have added a property in .h and I release it in dealloc in .m file. When I add objects to the array, I do the following:
myarray = [[NSMutableArray alloc] init];
[myarray addObject:[[mycustomObject alloc]initWithObject:obj1]];
...
Hello, I have this code
NSMutableArray *insideArray = [[NSMutableArray alloc] init];
NSMutableArray *outsideArray = [[NSMutableArray alloc] init];
[insideArray addObject:@"Hello 1"];
[insideArray addObject:@"Hello 2"];
[outsideArray addObject:insideArray];
[insideArray removeAllObjects];
[insideArray addObject:@"Hello 3"];
[insideAr...
While running Instruments to find leaks in my code, after I've loaded a file and populate an NSMutableArray with new objects, leaks pop up! I am correctly releasing the objects. Sample code below:
//NSMutableArray declared as a retained property in the parent class
if(!mutableArray)
mutableArray = [[NSMutableArray alloc] initWi...
So, I read this post, and it's pretty much exactly what I was looking for. However... it doesn't work. I guess I'm not going to go with the singleton object, but rather making the array in either a Global.h file, or insert it into the _Prefix file.
Both times I do that though, I get the error:
Expected specifier-qualifier-list before...
Hey,
I am creating a kinda gallery and for each gallery I created a view controller whose view is added to a scrollview (see code below) :
GalleryViewController *galViewController;
for (NSUInteger i = 0 ; i < [galleries count]; i++) {
galViewController = [[GalleryViewController alloc] init];
galViewController.record = [galleri...
I've looked through countless questions on here and elsewhere and cannot for the life of me figure out what I'm doing wrong.
I'm trying to store an array of CGPoints as NSValues inside of an NSMutableArray named points like so on the iPhone:
NSValue *point = [NSValue valueWithCGPoint:firstTouch];
NSLog(@"NSValue *point = %@", point);
[...
Hey there,
I never seem to get this right. I've got a method that returns a mutable array. What is the proper way to return the array and avoid potential memory leaks?
If I plan to store the results locally inside another view controller, does that affect the way the array should be returned?
Lastly, what if it's just an non-mutable...
I have a struct SystemStruct *sharedStruct = [SystemStruct sharedSystemStruct]; implemented as a singleton, to share 3 Arrays.
the problem is that when i try to count the array's objects the system crash.
es:
This code Crash:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
SystemStruct *Sha...
I have the following code:
NSLog(@"items: %d", [items count]);
NSLog(@"allObjects: %d", [self.allObjects count]);
[self.allObjects addObjectsFromArray:items];
NSLog(@"allObjects: %d", [self.allObjects count]);
Which produces the following output:
items: 7
allObjects: 0
allObjects: 0
items is a NSArray
allObjects is a NSMutableAr...
I want to verify if I'm in the last cell of the UITable.
Should I use a NSInteger property in my controller and store the value of the count of the data (it's an NSMutableArray) that populates the table?
I'm asking because I don't know if count iterates over all objects of the array to count or if it only gets me a value of a count prop...
Hey there,
I have a mutable array that contains mutable dictionaries with strings for the keys latitude, longitude and id. Some of the latitude and longitude values are the same and I want to remove the duplicates from the array so I only have one object per location.
I can enumerate my array and using a second enumeration review each...
Hello all,
I'm currently facing the following issue:
My app dynamically creates images (320 x 480 pixels) and adds them to a NSMutableArray. I need those images inside that array in order to allow users to browse through them back and forth. I only need to keep the latest 5 images. So I wrote a method like below:
- (void)addImageToArr...
I want to load the image URL from my NSMutableArray.
Here is my Code:
id path = (NSString *)[[stories objectAtIndex: storyIndex] objectForKey: @"icon"];
NSURL *url = [NSURL URLWithString:path];
NSData *data = [NSData dataWithContentsOfURL:url];
UIImage *img = [[UIImage alloc] initWithData:data cache:NO];
If I use: id path = @"http://w...
Hello,
in my current project I'm facing the following problem:
The app needs to exchange data with my server, which are stored inside a NSMutableArray on the iPhone. The array holds NSString, NSData and CGPoint values.
Now, I thought the easiest way to achieve this, was to convert the array into a properly formatted string, send it t...
After some searching, I got the following solution :
ref: http://stackoverflow.com/questions/1392909/nsmutablearray-addobject-with-mallocd-struct
CLLocationCoordinate2D* new_coordinate = malloc(sizeof(CLLocationCoordinate2D));
new_coordinate->latitude = latitude;
new_coordinate->longitude = longitude;
[points addObject:[NSData dataWithB...