Re: Using WebKit to Download Binary Files
Re: Using WebKit to Download Binary Files
- Subject: Re: Using WebKit to Download Binary Files
- From: "Mitchell Hashimoto" <email@hidden>
- Date: Mon, 21 Jan 2008 19:06:12 -0700
Hi Mike!
Since my last email I have been using NSUrlDownload! Specifically
mixing your response + Uli's. This is my code below. The thing is...
it DID work one time. I saw it work one time! But it has failed about
100 times in a row since then. Each time it fails it throws random
(seemingly) errors. Console is showing me no error message and the
stack trace is mysterious... it makes no sense. It seems like its
throwing errors while attempting to contact the delegate, so I
implemented each delegate method I saw it trying to reach in the stack
trace, and yet it still wont' work. I'm very very confused, because it
did work ONE time (and not the first time, just one random time as I
reran the code over and over)
- (void)webView:(WebView *)sender decidePolicyForMIMEType:(NSString
*)type request:(NSURLRequest *)request frame:(WebFrame *)frame
decisionListener:(id < WebPolicyDecisionListener >)listener
{
if ([type isEqualToString:@"application/x-gzip"]) {
[listener download];
NSURLDownload *down = [[NSURLDownload alloc] initWithRequest:request
delegate:self];
[down setDestination:@"/Users/mitchellh/Desktop/test.tgz" allowOverwrite:YES];
NSLog(@"Download");
return;
}
[listener use];
NSLog(@"%@", type);
}
On Jan 21, 2008 7:02 PM, Mike Abdullah <email@hidden> wrote:
> Sorry, maybe I'm missing something here, but wouldn't NSURLDownload do
> the job?
>
> Mike.
>
>
> On 22 Jan 2008, at 01:10, Mitchell Hashimoto wrote:
>
> > Hi,
> >
> > I looked into all the delegates listed on the WebView class reference
> > on apple docs and could not find anything. Are there any ideas?
> >
> > Thanks,
> > Mitchell
> >
> > On Jan 21, 2008 10:17 AM, Uli Kusterer
> > <email@hidden> wrote:
> >>
> >> On 21.01.2008, at 18:55, Mitchell Hashimoto wrote:
> >>> I'm trying to use WebKit to download a ZIP file. The reason I am
> >>> using
> >>> WebKit is because to get to the ZIP files it requires a web login
> >>> first, which I am automating. How can I load ZIP files and save
> >>> their
> >>> contents to a file on disk?
> >>
> >>
> >> Have you tried the web view's URL loading delegate? Maybe that lets
> >> you hook in there and use an NSURLRequest (NSURLHandle?
> >> NSURLConnection? Whatever the non-deprecated URL download thing was
> >> called again) to download the ZIP yourself?
> >>
> >> Cheers,
> >> -- M. Uli Kusterer
> >> "The Witnesses of TeachText are everywhere..."
> >> http://www.zathras.de
> >>
> >>
> >>
> >>
> >>
> > _______________________________________________
> >
> > 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