nsset

iPhone: Fast enumeration, not fast enough?

I am trying to loop through an NSSet that has about 6500 items in it. I am using: for (id Location in sortedArray) { loc = [sortedArray objectAtIndex:i]; cord = [cord stringByAppendingString:[NSString stringWithFormat:@"%f,%f ",[loc.longitude doubleValue],[loc.latitude doubleValue]]]; i++; } ...

Reducing an array of objects to unique objects based on attributes

Ok. I have an array with multiple objects populated by my core data stack . Lets say each object has a name, startdate, enddate and amount attribute associated with them What I need to do is reduce this array down to only the unique objects (not just values) based on the name, which is an NSString. I've tried isEqual methods within fo...

Getting an object from an NSSet

If you can't get an object with objectAtIndex: from an NSSet then how do you retrieve objects? ...

How to return an NSMutableArray from an NSSet

I'm able to put the contents of an NSSet into an NSMutableArray like this: NSMutableArray *array = [set allObjects]; The compiler complains though because [set allObjects] returns an NSArray not an NSMutableArray. How should this be fixed? ...

Preventing duplicate copies in a table view

I have an NSMutableArray that I display through a table view. The problem is that when I add objects to this array, I don't want to have duplicates. If I create an NSMutableSet from the NSMutableArray, then add objects to the NSMutableSet and then convert it back to an NSMutableArray, is that any more efficient than checking the NSMutab...

Will [NSSet allObjects] return an array with the same order each time?

I have a list of custom objects being returned from a .NET WebService and am storing them using a To-Many relationship from the parent enitity with Core Data. I want to use the NSSet as the datasource for a UITableView and push a new controller onto the stack when a row is selected. When using [NSSet allObjects] does the array re...

unique values of custom object NSString property in nsarray

I have an array which stores custom objects. Objects are of type Venue which have a property defined as name(which contains the names of venue). Now I want to filter out objects with unique names. This is how I was trying to do. NSSet *uniqueVenuesSet = [NSSet setWithArray:[venueArray valueForKey:@"name"]]; NSMutableArray *uniqueVe...

Using KVC to find the maximum value in an NSSet

Hi all. I'm trying to find the maximum value in the order property in this coredata object: #import <Foundation/Foundation.h> #import "Story.h" @class Story; @interface Sentence : NSManagedObject { } @property (nonatomic, retain) NSString *text; @property (nonatomic, retain) NSString *image; @property (nonatomic, re...

merging an nsarray into an nsset and avoiding duplicates in objective-c on iphone

Edit: better example... So I have an NSMutableSet of "existing" objects and I'd like to download JSON data, parse it, and merge these new objects with my existing ones, updating any duplicates with the newly downloaded ones. Here's what the existing set of objects looks like: NSArray *savedObjects = [NSArray arrayWithObjects: [NSD...