user425243
user425243

Reputation:

Unclear Information about NSData - Objective C/Xcode

I am using the following lines of code to download and save an html page ::

NSURL *goo = [[NSURL alloc] initWithString:@"http://www.google.com"];
NSData *data = [[NSData alloc] initWithContentsOfURL:goo]; 

What is actually contained in this data ?? Does it also contain CSS files and images that are displayed on the google homepage ?? I tried to NSLog this data but the result was not useful. I mean I could no tunderstand the result displayed in the gdb.

Upvotes: 0

Views: 297

Answers (3)

Gyani
Gyani

Reputation: 2241

Try to convert NSData to NSString and then NSLog it you will see what actually data contains

NSString* dataStr = [[[NSString alloc] initWithData:theData
                                           encoding:NSUTF8StringEncoding] autorelease];
NSLog(@"%@",dataStr);

Upvotes: 1

Antonio MG
Antonio MG

Reputation: 20410

As you can find here:

NSData Reference

NSData is just an array of bytes you use to store some info, in your case, the HTML response

Upvotes: 0

Martin Ullrich
Martin Ullrich

Reputation: 100801

The contained data is just what you get as a response to the request so html only

Upvotes: 2

Related Questions