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 trialGrégory Gyselinck
2,350 Points"&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 !
1 Answer
Tim Luk
5,140 PointsThe 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.
Joon Son
5,269 PointsJoon Son
5,269 Points