• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Issue with the downloading url
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issue with the downloading url


  • Subject: Re: Issue with the downloading url
  • From: Jean-Daniel Dupas <email@hidden>
  • Date: Thu, 6 Nov 2008 18:05:32 +0100

I don't know why it does not works using [NSData dataWithContentsOfURL:URL] but if you want to do some http download, you should use the modern URL Loading API.

NSError *error;
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://yp.shoutcast.com/sbin/tunein-station.pls? id=9907"]];
NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:nil error:&error];
if (!data) [NSApp presentError:error];



Le 6 nov. 08 à 17:22, Arnab Ganguly a écrit :

I am trying out the following

NSURL *url = [NSURL URLWithString:@"
http://yp.shoutcast.com/sbin/tunein-station.pls?id=9907";];
NSData *data = [NSData dataWithContentsOfURL:URL];
[data writeToFile:@"/tmp/station.pls" atomically:YES];


But unfortunately no such files gets generated.Can you suggest me the
approach I need to proceed with this.
Thanks


On Thu, Nov 6, 2008 at 7:48 PM, Jean-Daniel Dupas <email@hidden >wrote:



Le 6 nov. 08 à 15:02, Arnab Ganguly a écrit :

Hi All,
My requirement is to download the html file in my machine.I am trying to
execute the below code,it gets executed correctly but when I go to the
/tmp
dir I don't see any file getting downloaded.Any help would be very much
appreciated.


NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL
URLWithString:@
"http://www.videolan.org/vlc/download-sources.html";]

                cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:60.0];


NSURLDownload *theDownload=[[NSURLDownload alloc] initWithRequest:theRequest delegate:self]; if (theDownload) { [theDownload setDestination:@"/tmp" allowOverwrite:YES]; }

Thanks and regards
Arnab
_____



IIRC setDestination:allowOverwrite: expect a file path, not a directory
one.


Note that you should also read the "Temporary Files" section of the "Where
to put application Files" guide to know why this is a bad idea to use /tmp



http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/Articles/WhereToPutFiles.html



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Issue with the downloading url
      • From: "Arnab Ganguly" <email@hidden>
References: 
 >Issue with the downloading url (From: "Arnab Ganguly" <email@hidden>)
 >Re: Issue with the downloading url (From: Jean-Daniel Dupas <email@hidden>)
 >Re: Issue with the downloading url (From: "Arnab Ganguly" <email@hidden>)

  • Prev by Date: Re: [Q] How to add nested items to NSOutlineView?
  • Next by Date: dragging an image to Photoshop dock tile
  • Previous by thread: Re: Issue with the downloading url
  • Next by thread: Re: Issue with the downloading url
  • Index(es):
    • Date
    • Thread