From: Richard Frith-Macdonald <richard@brainstorm.co.uk>
To: "Yen-Ju Chen" <yjchenx@hotmail.com>
CC: help-gnustep@gnu.org
Subject: Re: How to use [NSURL loadResourceDataNotifyingClient:usingCache:]
?
Date: Tue, 25 Mar 2003 10:10:33 +0000
On Monday, March 24, 2003, at 09:54 pm, Yen-Ju Chen wrote:
Hi,
I try to use [NSURL loadResourceDataNotifyingClient:usingCahce:],
but it doesn't work at all.
I implement both -URLHandleResourceDidBeginLoading:
and -URLResourceDidBeginLoading: in the client.
But they are never called.
Does it work in GNUstep ? Or am I doing something wrong ?
You are doing something wrong ...
1. The -URLHandleResourceDidBeginLoading: method is sent to the NSURL
object, not to its client. So implementing this in the client will have no
effect. If you want the method to be called you need to make your object a
client of an NSURLHandle rather than an NSURL.
2. The -URLResourceDidBeginLoading: method is not part of the URLClient
protocol, so NSURL clients should not and do not get sent a method
notifying them when loading starts. This is presumably because the only
way to make an object a client of an NSURL is by sending the NSURL instance
a -loadReasourceDataNotifyingClient:usingCache: method. ie your code
already knows that loading has just begun, so it can tell the client that
itsself. I can't think of any other reason why Apple would have decided
not to put a method like that in the protocol.