I want to use allContactedBodies instead of didBeginContact & didEndContact.
When I do :
NSLog(@\"%@\", node.physicsBody.allContactedBodies );
<
Apparently, when collisions happen very rapidly, contacts with multiple nodes are reported simultaneusly. In this case, only one of the collisions will be detected in didBeginContact, and you may lose the contact you are interested in.
You can detect simultaneous (or almost simultaneous) contacts in didBeginContact as follow, and use it to apply whatever logic you need.
NSArray *tempArray = [mySprite.physicsBody allContactedBodies];
BOOL contactWithNodeOfInterest = NO;
int i = 0;
for(SKPhysicsBody *body in tempArray)
{
if([body.node.name isEqualToString:@"nodeOfInterest"]) { contactWithNodeOfInterest = YES; }
NSLog(@"Contacts: %i %@",i,body.node.name);
i = i + 1;
}