Unregistered
2002.07.18, 12:28 PM
----in header file
NSURL *site;
NSURLHandle *theFile;
---in header file
-(void)awakeFromNib{
site=[[NSURL alloc]initWithString:@"http://www.macosrumors.com/images/logo.gif"];
theFile=[site URLHandleUsingCache:NO];
[theFile addClient:self];
[theFile beginLoadInBackground];}
- (void)URLHandle:(NSURLHandle *)sender resourceDidFailLoadingWithReason:(NSString *)reason{NSLog(@"%@",reason);}
- (void)URLHandleResourceDidFinishLoading:(NSURLHand le *)sender{NSLog(@" %f bytes",[[sender resourceData]length]);}
- (void)URLHandleResourceDidBeginLoading:(NSURLHandl e *)sender{NSLog(@"started");}
ok, where to start.......
I have a URL, that i use to make a urlhandle, that i tell to load. I also add self as a client so i will be notified when something happens.
Now for the weird stuff.
1)If i use "theFile=[[NSURLHandle alloc]initWithURL:site cached:NO];" then i get this in the Run pane of pb
"
*** -beginLoadInBackground cannot be sent to an abstract object of class NSURLHandle: Create a concrete instance!"
so i set file using "theFile=[site URLHandleUsingCache:NO];"
2)beginLoadInBackground does nothing, i have to have it load
calling "[theFile resourceData];" now it will load but only
"URLHandleResourceDidFinishLoading:"
is called, and when i check for the data length it returns zero.
im just trying to get a NSURLHandle working correctly, but im not sure whats wrong?:confused:
NSURL *site;
NSURLHandle *theFile;
---in header file
-(void)awakeFromNib{
site=[[NSURL alloc]initWithString:@"http://www.macosrumors.com/images/logo.gif"];
theFile=[site URLHandleUsingCache:NO];
[theFile addClient:self];
[theFile beginLoadInBackground];}
- (void)URLHandle:(NSURLHandle *)sender resourceDidFailLoadingWithReason:(NSString *)reason{NSLog(@"%@",reason);}
- (void)URLHandleResourceDidFinishLoading:(NSURLHand le *)sender{NSLog(@" %f bytes",[[sender resourceData]length]);}
- (void)URLHandleResourceDidBeginLoading:(NSURLHandl e *)sender{NSLog(@"started");}
ok, where to start.......
I have a URL, that i use to make a urlhandle, that i tell to load. I also add self as a client so i will be notified when something happens.
Now for the weird stuff.
1)If i use "theFile=[[NSURLHandle alloc]initWithURL:site cached:NO];" then i get this in the Run pane of pb
"
*** -beginLoadInBackground cannot be sent to an abstract object of class NSURLHandle: Create a concrete instance!"
so i set file using "theFile=[site URLHandleUsingCache:NO];"
2)beginLoadInBackground does nothing, i have to have it load
calling "[theFile resourceData];" now it will load but only
"URLHandleResourceDidFinishLoading:"
is called, and when i check for the data length it returns zero.
im just trying to get a NSURLHandle working correctly, but im not sure whats wrong?:confused: