download a file using dataWithContentsOfURL
download a file using dataWithContentsOfURL
- Subject: download a file using dataWithContentsOfURL
- From: Thierry Bucco <email@hidden>
- Date: Fri, 1 Jun 2001 20:16:14 +0200
I am making a class which let my application to update itself.
I perform this :
I download the new version (using a Thread) of my software (it's a mac
binary encoded file) in /private/tmp using
[NSData dataWithContentsOfURL:[NSURL
URLWithString:@"
http://www.web.com/MyApp.sit.bin"]];
.
When the download is finished, I decode it using NSWorkspace method
openFile with StuffIt expander.
After this, I move my new application in the same directory replacing
the old one.
When the file is downloading I can't determine the number of bytes
received in order to indicate to the user the percentage left using a
progress bar. I tried [data lenght] but I don't have the right value
only when downloading is finish.
What must I do to know the bytes received during download ?
Thanks a lot for your help.
Thierry