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!
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
"&error" question !
the variable "error" is already a reference to the NSError object ? So it's an address... So why do we use the "&" ?
In the prototype of the method it's says
error:(NSError *)error What means the double * ?
Thank you !
The main reason why you will need to use & is to pass by reference. Without using &, you will be passing a copy of it. That means that if there is any error, the error is only within the scope of JSONSerialization. The error will not be passed to the NSError *error, since it's a copy rather than a reference. Hope it helps.