NSURLHandle - Never loads a url, never produces a failure message
NSURLHandle - Never loads a url, never produces a failure message
- Subject: NSURLHandle - Never loads a url, never produces a failure message
- From: April Gendill <email@hidden>
- Date: Wed, 31 Mar 2004 23:36:49 -0700
Below is the actual code except the URL, but the url I am using in the
app is valid.
When I call the lookForConnection method nothing ever happens. None of
the other methods are ever called. Now do keep in mind that the code I
first used was a direct cut and paste from one of my applications which
uses it and it works fine. I cannot figure out the difference. Below
however is exactly what I took from the working app except I cut out
everything but the NSLog lines.
I have tried creating an empty project and doing the same flat cut and
paste and it still fails. What Am I doing wrong????? Oh and by the way
yes, I added the <NSURLHandleClient>
I left the program running, waiting for like 10 minutes and nothing
ever happened. It never fails and never connects. Why does this code
work in one application and not in another?
- (void)URLHandle:(NSURLHandle *)sender
resourceDataDidBecomeAvailable:(NSData *)newBytes
{
NSLog(@"Available");
}
- (void)URLHandleResourceDidBeginLoading:(NSURLHandle *)sender
{
}
- (void)URLHandleResourceDidFinishLoading:(NSURLHandle *)sender
{
NSLog(@"Found Connection");
canDownload = YES;
}
- (void)URLHandleResourceDidCancelLoading:(NSURLHandle *)sender
{
}
- (void)URLHandle:(NSURLHandle *)sender
resourceDidFailLoadingWithReason:(NSString *)reason
{
NSLog(@"Failed");
}
-(void)lookForConnection
{
NSURL* theURL=[[[NSURL
alloc]initWithString:@"
http://www.myurl.com/testfile.txt"]autorelease];
Class theClass = [NSURLHandle URLHandleClassForURL:theURL];
NSURLHandle * theURLHandle = [[theClass alloc]initWithURL:theURL
cached:NO];
[theURLHandle addClient:self];
[theURLHandle loadInBackground];
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.