Extract Data from NSURLConnection return data

Discussion in 'iOS Programming' started by CocoaPuffs, Apr 25, 2009.

  1. CocoaPuffs macrumors 68010

    Aug 23, 2008
    Quick question, is substringWithRange the best way to extract specific data from raw data return from NSURLConnection?
  2. kainjow Moderator emeritus


    Jun 15, 2000
    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.?
  3. CocoaPuffs thread starter macrumors 68010

    Aug 23, 2008
    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.

Share This Page