开发者

How does it know which method to call?

This is a follow-on from a previous question, in the implementation, I have two methods, one which gets called when a particular service is found and the other when it vanishes. This might be a dumb question, but apart from the NSLog lines they are identical, what dictates which gets called?

// INTERFACE
@interface ITunesFinder : NSObject <NSNetServiceBrowserDelegate>
@end

.

// IMPLEMENT
@implementation ITunesFinder

// -------------------------------------开发者_开发百科------------------------------ **
-(void) netServiceBrowser: (NSNetServiceBrowser *) browser
           didFindService: (NSNetService *) service
               moreComing: (BOOL) moreComing {
    [service resolveWithTimeout:10];
    NSLog(@"Service Found: %@", [service name]);
}

// ------------------------------------------------------------------- **
-(void) netServiceBrowser: (NSNetServiceBrowser *) browser
         didRemoveService: (NSNetService *) service
               moreComing: (BOOL) moreComing {
    [service resolveWithTimeout:10];
    NSLog(@"Service Lost!: %@", [service name]);
}
@end

gary


They are not identical. The one has a parameter: didFindService and the other has a parameter didRemoveService.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜