Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialNAUSHAD DARUWALLA
1,587 PointsProblem distinguishing between values
Hello all, I am having a very peculiar problem in that when I add an object named upcomingEvent of Class upcomingEventObject to the array at self.delegate.upcomingEventItems (with delegate being the property to access the global variables), I am actually accessing the object I added to the array rather than the objectAtIndex: i of the array. I know this because when I go to output a String property of the said object from the objectAtIndex:i of the array, I only print the string value of the object that I added to the array. The corresponding code is attached below. What could be causing this and how do I fix it?
[self.delegate.upcomingEventItems addObject:self.upcomingEvent];
for (NSInteger i = 0; i<[self.delegate.upcomingEventItems count]; i++) {
upcomingEventObject* upcomingEvent = [self.delegate.upcomingEventItems objectAtIndex:i];
NSLog(@"Details: %@", [upcomingEvent.dateOfEvent.date description]);
}
Thank you