Cocos2d iphone ';找不到选择器的签名-是否具有以下格式-(无效)名称:(ccTime)dt';-cocos2d

Cocos2d iphone ';找不到选择器的签名-是否具有以下格式-(无效)名称:(ccTime)dt';-cocos2d,cocos2d-iphone,xcode4.5,Cocos2d Iphone,Xcode4.5,我一直收到相同的崩溃报告“'选择器的签名未找到-是否具有以下格式?-(无效)名称:(ccTime)dt'”。 现在这变得很烦人,我只想让背景无限滚动 这是我的密码: -(id) init { // always call "super" init // Apple recommends to re-assign "self" with the "super" return value if( (self=[super init])) { self.isTouchEnabled = YE

我一直收到相同的崩溃报告“'选择器的签名未找到-是否具有以下格式?-(无效)名称:(ccTime)dt'”。 现在这变得很烦人,我只想让背景无限滚动

这是我的密码:

-(id) init {

// always call "super" init
// Apple recommends to re-assign "self" with the "super" return value
if( (self=[super init])) {
    self.isTouchEnabled = YES;
    self.isAccelerometerEnabled = YES;

    CGSize screenSize = [CCDirector sharedDirector].winSize;

  /*CCSprite *Player = [CCSprite spriteWithFile:@"Icon.png"];
    Player.position = ccp(screenSize.width/2 -110, screenSize.height/2);
    Player.scale = 0.7;
    [self addChild:Player];

    [self scheduleUpdate];*/

    CCLOG(@"Screen width %0.2f screen height %0.2f",screenSize.width,screenSize.height);

    b2Vec2 gravity;
    gravity.Set(0.0f, -10.0f);

    bool doSleep = true;

    world = new b2World(gravity, doSleep);
    world->SetContinuousPhysics(true);

    // Debug Draw functions
    /*m_debugDraw = new GLESDebugDraw( PTM_RATIO );
    world->SetDebugDraw(m_debugDraw);

    uint32 flags = 0;
    flags += b2DebugDraw::e_shapeBit;
    //flags += b2DebugDraw::e_jointBit;
    //flags += b2DebugDraw::e_aabbBit;
    //flags += b2DebugDraw::e_pairBit;
    //flags += b2DebugDraw::e_centerOfMassBit;
    m_debugDraw->SetFlags(flags);*/

    // Define the ground body.
    b2BodyDef groundBodyDef;
    groundBodyDef.position.Set(0, 0); // bottom-left corner

    // Call the body factory which allocates memory for the ground body
    // from a pool and creates the ground box shape (also from a pool).
    // The body is also added to the world.
    b2Body* groundBody = world->CreateBody(&groundBodyDef);

    // Define the ground box shape.
    b2PolygonShape groundBox;

    // bottom
    groundBox.SetAsEdge(b2Vec2(0,0), b2Vec2(screenSize.width/PTM_RATIO,0));
    groundBody->CreateFixture(&groundBox,0);

    // top
    groundBox.SetAsEdge(b2Vec2(0,screenSize.height/PTM_RATIO),         b2Vec2(screenSize.width/PTM_RATIO,screenSize.height/PTM_RATIO));
    groundBody->CreateFixture(&groundBox,0);

    //Set up sprite

    BG1 = [CCSprite spriteWithFile:@"SkyAndClouds.png"];
    BG1.anchorPoint = ccp(0,0);
    BG1.position = ccp(0, 0);
    BG1.scale = 0.5;
    [self addChild:BG1];

    BG2 = [CCSprite spriteWithFile:@"SkyAndClouds.png"];
    BG2.anchorPoint = ccp(0,0);
    BG2.position = ccp([BG1 boundingBox].size.width-1,0);
    [self addChild:BG2];

    [self schedule: @selector(AnimatedBG:) interval:0];

    CCSpriteBatchNode *batch = [CCSpriteBatchNode batchNodeWithFile:@"Stick.png" capacity:150];
    [self addChild:batch z:0 tag:kTagBatchNode];

    [self addNewSpriteWithCoords:ccp(screenSize.width/2-110, screenSize.height/2)];
    [self addZombieWithCoords:ccp(screenSize.width/2+240, screenSize.height/2)];

    CCLabelTTF *label = [CCLabelTTF labelWithString:@"Stick, you Better Run!" fontName:@"Helvetica" fontSize:16];
    [self addChild:label z:0];
    [label setColor:ccc3(0,0,255)];
    label.position = ccp( screenSize.width/2, screenSize.height-17);

    [self schedule: @selector(tick:)];
}

return self;
}

-(void)AnimatedBG {
    BG1.position = ccp(BG1.position.x-1,BG1.position.y);
}

您的AnimatedBG方法应定义为:

-(void) AnimatedBG:(ccTime)dt {

}
您还应确保为计划的勾号:方法定义:

-(void) tick:(ccTime)dt {

}

谢谢就在你发布这个答案之前,我已经解决了这个问题,不过还是要谢谢你:)