carlogulliani (carlogulliani) wrote in macosxdev,
carlogulliani
carlogulliani
macosxdev

reference between classes

 Hello, i have 2 classes: A and B.

I wanna call some B's method from A.

class A:

- (IBAction) callmethod:(id)sender
{
A *a_method = [[A init] alloc];
[a_method performSelector: @selector(b_method) withObject: nil afterDelay: 2.0];
[a_method release];
}

class B:

-(void)b_method
{
NSLog(@"b_method was called");
NSNetService * rs = [service objectAtIndex:0];
rs.delegate = self;
[rs resolveWithTimeout:10];
}

after it should calling onSocket

-(void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port
{
NSLog(@"did connect to host");
}

but i've not result, i have just 'b_method was called' this method was not called

but if i'll add IBAction's method to B class:

class B
-(IBAction) buttonpressed:(id)sender
{
[self b_method];
}

then i have 'did conntct to host in debug mode'

  • Post a new comment

    Error

    default userpic

    Your IP address will be recorded 

  • 3 comments