title: Box2D body with animating sprite sheet plist
body: <p>I have created an animating sprite using CCSpriteBatchNode and CCSprite. I use plist to get frames. Here is the code I put it in init().</p>
  
  <pre><code>//================== making animating sprite
      [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile: @"framelist.plist"];
      CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode 
                                        batchNodeWithFile:@"frames.png"];
      [self addChild:spriteSheet];
  
      NSMutableArray *walkAnimFrames = [NSMutableArray array];
      for(int i = 1; i &lt;= 2; ++i) {
          [walkAnimFrames addObject:
           [[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:
            [NSString stringWithFormat:@"frame%d.png", i]]];
      }
  
      CCAnimation *walkAnim = [CCAnimation 
                               animationWithFrames:walkAnimFrames delay:0.1f];
      //_frameSprite is CC Sprite
  
      _frameSprite = [CCSprite spriteWithBatchNode:spriteSheet 
                                        rect:CGRectMake(0,0,48,48)];
      _frameSprite.position = ccp(winSize.width + 60, winSize.height/2);
      _flyAction = [CCRepeatForever actionWithAction:
                    [CCAnimate actionWithAnimation:walkAnim restoreOriginalFrame:NO]];
      [_frameSprite runAction:_flyAction];
      [spriteSheet addChild:_frameSprite];
  </code></pre>
  
  <p>Once the sprite is ready and running on screen I created b2BodyDef and assign b2Body (i.e. frameBodyDef, frameBody) my sprite as shown below.</p>
  
  <pre><code>b2BodyDef frameBodyDef;
      frameBodyDef.type = b2_staticBody;
      frameBodyDef.position.Set(160/PTM_RATIO, 200/PTM_RATIO);
      frameBodyDef.userData = _frameSprite;
      frameBody = _world-&gt;CreateBody(&amp;frameBodyDef);
  </code></pre>
  
  <p>After creating the body, when build and ran, the program crashes at line </p>
  
  <pre><code>frameBody = _world-&gt;CreateBody(&amp;frameBodyDef);
  </code></pre>
  
  <p>Saying BAD ACCESS.</p>
  
  <p>Please kindly help me out in this, why the animating sprite cannot be added to the body???</p>
  
  <p>Thank you.</p>