user5746191
user5746191

Reputation:

read NSData line by line in objective-c

I am new to iOS.

I have NSData from urlRequest and able to see it in console while using the following code.

NSString *s = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];

This returns the data as

<html>   <head>  </head> <body> myContent..  </body>  </html>

How to iterate this data and I need to get them as line by line as NSString, as below

     <html>
     <head>
     </head>
     <body>
     myContent..
     </body>
     </html>

Thanks in advance

Upvotes: 0

Views: 175

Answers (1)

Ulysses
Ulysses

Reputation: 2317

I recommend you to use HTML parse libraries to help you in this task.

You can use libs GDataXML-HTML, with have good tutorials.

Other good libs for this propose,

HTMLParser

Kanna

Upvotes: 1

Related Questions