NSURLDownload!

Einstein

Membre enregistré
19 Novembre 2003
5
0
Salut!

Voilà, j'aimerais pouvoir depuis un prog télécharger un fichier depuis mon serveur. Pour ce, j'ai voulu utiliser NSURLDownload. J'ai donc regardé dans la doc Apple et j'ai trouver plein de truc géniaux,………mais qui ne marche pas!
frown.gif

J'ai donc implémenté mon code de cette façon: <font class="small">Code:</font><hr /><pre>- (void)startDownloadingURL:sender
{
// create the request
NSURLRequest *theRequest=[NSURLRequest requestWithURL:[NSURL URLWithString:mad:"http://www.monserveur.fr/test.zip"] cachePolicy:NSURLRequestReturnCacheDataElseLoad timeoutInterval:60.0];
// create the connection with the request
// and start loading the data
theDownload = [[NSURLDownload alloc] initWithRequest:theRequest delegate:self];
if (theDownload) {
// set the destination file now
[theDownload setDestination:[[@"~/Desktop/DL/" stringByExpandingTildeInPath] retain] allowOverwrite:YES];
} else {
// inform the user that the download could not be made
}
}


- (void)download:(NSURLDownload *)download didFailWithError:(NSError *)error
{
// release the connection
[download release];

// inform the user
NSLog(@"Download failed! Error - %@ %@",
[error localizedDescription],
[[error userInfo] objectForKey:NSErrorFailingURLStringKey]);
}

- (void)downloadDidFinish:(NSURLDownload *)download
{
// release the connection
[download release];

// do something with the data
NSLog(@"downloadDidFinish");
}</pre><hr /> Malheureusement, ça me retourne tjs l'erreur illogique qui suit: "Impossiblde de créer le fichier http://www.monserver.fr/test.zip" !!!! Idiot non?!
ooo.gif


Alors si quelqu'un a une idée… Merci!
 
ouais, bon, je suis sous 10.3.1 avec of course Xcode donc j'ai déja cherché dans la doc Apple et n'ai aussi
crazy.gif
trouvé que ça!
Enfin, je demandais si quelqu'un l'avais déjà utilisé et si ça avais marché? En plus, si cette ipoTtik personne pouvait me renseigner sur le sujet, se serait le pied total!
laugh.gif