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 trial

iOS

Rycardo C
Rycardo C
4,599 Points

Question for Amit re Events project

Hey Amit, I was having a lot of problems with this project. I'll spare you the details, but I only found the error by comparing my typed files to the download project files. My mistake was when creating the Event properties. Can you please explain when to and why to use "copy" instead of "strong"? Specifically I'm talking about these lines: @property (nonatomic, copy) NSString *title; @property (nonatomic, copy) NSDate *startTime; @property (nonatomic, copy) NSString *venueName;

Thanks! Rycardo

2 Answers

Amit Bijlani
STAFF
Amit Bijlani
Treehouse Guest Teacher

In the events project you are downloading and parsing an XML file. As you parsing the XML file you are storing the value of each element in a temporary variable. That temporary variable needs to then "copied" to the individual properties of the Event object. If you don't "copy" the value then you are holding on to the existing value in the temporary variable which is what strong does.

Rycardo C
Rycardo C
4,599 Points

That makes sense, thanks for explaining!