title: Class Method not invoked in didBeginContact method
body: <p>I created two classes: one to handle projectiles and the main scene itself. When I call the class method to spawn projectiles, in the didMoveToView or any other method, it works and I'm able to see the projectiles. However, when I want the projectiles to spawn after a contact, it does not work. I tested the contacts before and everything is working properly. What am I missing here?</p>
  
  <p><strong>didBeginContact Method</strong></p>
  
  <pre><code>static inline Enemies *nodeFromBody(SKPhysicsBody *body1, SKPhysicsBody *body2, uint32_t category) {
      Enemies *node = nil;
      if (body1.categoryBitMask &amp; category) {
          node = (Enemies *)body1.node;
      }
      else if (body2.categoryBitMask &amp; category) {
          node = (Enemies *)body2.node;
      }
      return node;
  }
  
  -(void)didBeginContact:(SKPhysicsContact *)contact {
  
      SKPhysicsBody *firstBody, *secondBody;
  
      SKSpriteNode *projectile = nil;
      SKSpriteNode *offScreen = nil;
      Enemies *target = nil;
  
      firstBody = contact.bodyA;
      secondBody = contact.bodyB;
  
      projectile = nodeFromBody(firstBody, secondBody, projectileCategory);
      offScreen = nodeFromBody(firstBody, secondBody, offScreenCategory);
      target = nodeFromBody(firstBody, secondBody, targetsCategory);
  
      if (projectile &amp;&amp; target) {
  
          NSLog(@"firstShot");
          [projectile removeFromParent];
          // Below is the class method being invoked.
          [ProjectilePatterns pattern1:self spawnPoint:CGPointMake(CGRectGetMidX(self.frame), CGRectGetMidY(self.frame))];
          [target removeFromParent];
      }
  }
  </code></pre>
  
  <p><strong>The Class Method</strong> </p>
  
  <pre><code>+(ProjectilePatterns *)pattern1:(SKScene *)scene spawnPoint:(CGPoint)location {
  
      ProjectilePatterns *patternBomb = [ProjectilePatterns spriteNodeWithColor:[UIColor blueColor] size:CGSizeMake(20, 20)];
      patternBomb.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:patternBomb.size];
      patternBomb.physicsBody.categoryBitMask = projectileCategory;
      patternBomb.physicsBody.contactTestBitMask = targetsCategory | offScreenCategory;
      patternBomb.physicsBody.collisionBitMask = 0;
      patternBomb.physicsBody.friction = 0;
      patternBomb.physicsBody.linearDamping = 0;
      patternBomb.position = CGPointMake(location.x + 20, location.y);
      patternBomb.name = @"p1";
      NSLog(@"works");
  
      [scene addChild:patternBomb];
      [patternBomb.physicsBody applyImpulse:CGVectorMake(3, 0)];
  
      return patternBomb;
  }
  </code></pre>