How to download file from particular url???

Posted by greshi gupta on Stack Overflow See other posts from Stack Overflow or by greshi gupta
Published on 2010-04-23T06:06:50Z Indexed on 2010/04/23 6:13 UTC
Read the original article Hit count: 241

Filed under:
NSURL * url = @"http://192.168.100.161/UploadWhiteB/wh.txt";
NSData * data = [NSData dataWithContentsOfURL:url];

if (data != nil) {
    NSLog(@"\nis not nil");
    NSString *readdata = [[NSString alloc] initWithContentsOfURL:(NSData *)data ];

I write this code to download a file from given url... but i get an error on line NSData * data = [NSData dataWithContentsOfURL:url];

uncaught exception....so please help me out..

© Stack Overflow or respective owner

Related posts about objective-c