PDA

View Full Version : Extract Data from NSURLConnection return data




CocoaPuffs
Apr 25, 2009, 08:10 PM
Quick question, is substringWithRange the best way to extract specific data from raw data return from NSURLConnection?



kainjow
Apr 25, 2009, 11:38 PM
NSURLConnection gives you an NSData object, so you'd have to convert your data to an NSString first to use that method (and you'd have to know the encoding). Once you have a string though, extracting bits of information from it depend entirely on the format, so substringWithRange would not always be the best. What if it was XML, tab-delimited, etc.?

CocoaPuffs
Apr 26, 2009, 01:25 AM
Sorry I wasn't being more specific. I was trying to extract the authorization token from Google, and thought maybe there might be a better approach.