Reputation: 5495
I am currently going through the Pragmatic iOS 6 book, and am having trouble understanding the following line of code explained in chapter 3 under the section about GCD:
NSJSONSerialization *jsonResponse = [NSJSONSerialization JSONObjectWithData:data options:0 error:&jsonError];
//... some code here
NSArray *tweets = (NSArray *) jsonResponse; //<-- this line
Is it saying that the NSJSONSSerialization
object could automatically return an instance of NSSArray, which is then stored in the tweets
? I checked the Apple docs, but only saw items on restrictions using NSJSONSerialization
, but not what objects it could then get converted to.
Thanks!
Upvotes: 2
Views: 6199
Reputation: 5301
NSJSONSerialization can take a chunk of JSON data and turn into objects and it can do the same in the other direction that is by taking objects and converting them into the JSON data.
For easy understanding of NSJSONSerialization and interaction with Twitter, i would recommend you to use THIS and THIS tutorials.
Hope this helps!
Upvotes: 6