code to download data from web server

0 views
Skip to first unread message

Shilpa

unread,
Jun 23, 2008, 10:13:32 AM6/23/08
to iPhoneOSCoders
I am tring to use NSURLRequest to access data stored in a database
hosted on web server.But the sample code for NSURLRequest mentioned in
the apple documentation specifies an instance method "receivedData". I
couldnot find much details about this.If anybody has an idea about
this please help?

Michael Rutman

unread,
Jun 23, 2008, 12:33:22 PM6/23/08
to iphoneo...@googlegroups.com

Which sample code? Can you give me the snippet that confuses you?

Shilpa

unread,
Jun 25, 2008, 9:35:58 AM6/25/08
to iPhoneOSCoders

This is the sample code for creating a connection:

// create the request

NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL
URLWithString:@"http://www.apple.com/"]

cachePolicy:NSURLRequestUseProtocolCachePolicy

timeoutInterval:60.0];

// create the connection with the request

// and start loading the data

NSURLConnection *theConnection=[[NSURLConnection alloc]
initWithRequest:theRequest delegate:self];

if (theConnection) {

// Create the NSMutableData that will hold

// the received data

// receivedData is declared as a method instance elsewhere

receivedData=[[NSMutableData data] retain];

} else {

// inform the user that the download could not be made

}


It is commented that "receivedData is declared as a method instance
elsewhere". This part is not clear to me.

Michael Rutman

unread,
Jun 26, 2008, 10:48:13 AM6/26/08
to iphoneo...@googlegroups.com

I would assume that means the instance method is declared in the class
declaration.

Look for @interface

Reply all
Reply to author
Forward
0 new messages