Search code examples
iossprite-kitchipmunkskspritenodespritebuilder

use of undeclared identifier 'SKSpriteNode'


I'm trying to define an SKSprite Node SKSpriteNode *ball but I'm getting this message "use of undeclared identifier 'SKSpriteNode'"

I'm building my game with the help of SpriteBuilder Cocos2d and chipmunk physics using objective-C, my deployment target is IOS6 i tried to pot it to IOS7 but still the problem didn't get solved.

In my interface i included CCPhysicsCollisionDelegate. I can use and define CCSprite and CCPhysicsNode without any problems.

I'm trying to detect collisions using collisionBitMask

I read SKSpriteNode Class reference but didn't find anything useful for my problem or maybe i just didn't understand will https://developer.apple.com/library/ios/documentation/SpriteKit/Reference/SKSpriteNode_Ref/Reference/Reference.html#//apple_ref/occ/cl/SKSpriteNode

I captured the error that i get in Xcode "focus on the SKSpriteNode error" Capture from Xcode

Any help or hint would be appreciated ..


Solution

  • If you are using SpriteKit then you should import:

    #import <SpriteKit/SpriteKit.h>
    

    You should be using the Sprite Kit framework (among other frameworks):

    SpriteKit.framework
    

    And you should be using iOS 7 or higher since SpriteKit requires that.

    But a better question is what are you trying to use? Are you using SpriteKit or cocos2d? Correct me if I am wrong but from the looks of it you have the two confused. SpriteKit and cocos2d are not one in the same and you wouldn't be using code from one in the other.