Question: I have 2 class, classA and classB.

ObjectA have a property which is ObjectB. Now the scenario is-

1. ObjectA call ObjectB method- [ObjectB methodB1].
2. after executing method [ObjectB methodB1], objectB send callback to objectA.
3. getting callback ObjectA release ObjectB. did it following way-

[ObjectB release];
ObjectB = nil;
4. ObjectB has another method ->methodB2, which starts executing [ObjectB methodB2] just after sending callback to objectA and it crashes because ObjectA released ObjectB when it's executing, so there is no object then ObjectB.

So if how to solve this problem?

Thanks for your answer.

Answer: 
move your callback to ObjectA just after the execution of [ObjectB methodB2].
Or create two callbacks : one after [ObjectB methodB1] and another after [ObjectB methodB2] and release ObjectB after the second callback
two scenario's here:

1) ObjectB could have different properties passed to it when called by ObjectA the two times

2) Object B is only ever passed one set of properties and Object A needs Bethod B1 and B2 to run while ObjectB retains the same properties.

3) Use getters and setters if object B needs new parameters passed to it?

Scenario 1:

ObjectA.m:

```
    ...
     ObjectB *objectB = [[ObjectB alloc] initWithSomeParameter:@"the parameter"];
     NSString *callback1 = [objectB methodB1];
    // why release when you can repoint?
     ObjectB *objectB = [[ObjectB alloc] initWithSomeParameter:@"another parameter"];
     NSString *callback2 = [objectB methodB2];
    [objectB release];

```

Scenario 2:

ObjectA.m:

```
    ...
     ObjectB *objectB = [[ObjectB alloc] initWithSomeParameter:@"the parameter"];
     NSString *callback1 = [objectB methodB1];
     NSString *callback2 = [objectB methodB2];
    [objectB release];

```

Scenario 3:

ObjectA.m:

```
    ...
     ObjectB *objectB = [[ObjectB alloc] initWithSomeParameter:@"the parameter"];
     NSString *callback1 = [objectB methodB1];
    [objectB setSomeParameter:@"another parameter"];
     NSString *callback2 = [objectB methodB2];
    [objectB release];

```

When you say ObjectB calls back? I hope you don't mean:

ObjectA.m:

```
     ObjectB *objectB = [[ObjectB alloc] initWithSomeParameter:@"the parameter"];
     NSString *callback1 = [objectB methodB1];
     ...

```

ObjectB.m:

```
     ...
     //DO some work in method B1
     ObjectA *objectA [[ObjectA alloc] init];
     [objectA callback];

```

That's a memory lead looming over you right there and then... If this IS what you mean, then I'd advise reading my above scenario's or looking at NSNotificationCentre Notifications for cross object notifications i.e. callbacks.