user2348363
user2348363

Reputation: 13

Search NSArray and add to NSMutableArray

I have an Xcode project with two NSArrays of objects, one named completionArray filled with @"yes" and @"no" and one named allRequirements with objects that represent college classes such as @"ITCS 1215". My goal is to search completionArray until I reach @"no", then copy the object at that index from allRequirements in to suggestionArray, a NSMutableArray.

Here is my code so far, which does not work because it is throwing the error "Expected Identifier" after the last closing bracket.

for (int i = 0; i < [self.allRequirements count]; i++)
{
    if([self.completionArray[i] isEqual:@"no"])
        [self.suggestionArray addObject:[self.allRequirements[i]];
}

Thanks all.

Upvotes: 0

Views: 89

Answers (1)

David Hoerl
David Hoerl

Reputation: 41682

Change this line:

[self.suggestionArray addObject:[self.allRequirements[i]];

to:

[self.suggestionArray addObject:self.allRequirements[i]];

Upvotes: 2

Related Questions