Cocos2d iphone ios6模拟器中的Cocos2d

Cocos2d iphone ios6模拟器中的Cocos2d,cocos2d-iphone,ios6,sigabrt,Cocos2d Iphone,Ios6,Sigabrt,我用平铺贴图编辑器Cocos2d和Xcode编写了一个简单的程序,上一次我尝试了它,它工作了,但现在我得到了新的iOS 6模拟器,它没有。错误只是“Sigbrt”,它表示要中止的信号。我不知道我的程序出了什么问题。这是Hellowrold.h // // HelloWorldLayer.h // game // // Created by Alex Reichenbach on 9/29/12. // Copyright __MyCompanyName__ 2012. All right

我用平铺贴图编辑器Cocos2d和Xcode编写了一个简单的程序,上一次我尝试了它,它工作了,但现在我得到了新的iOS 6模拟器,它没有。错误只是“Sigbrt”,它表示要中止的信号。我不知道我的程序出了什么问题。这是Hellowrold.h

//
//  HelloWorldLayer.h
//  game
//
//  Created by Alex Reichenbach on 9/29/12.
//  Copyright __MyCompanyName__ 2012. All rights reserved.
//


// When you import this file, you import all the cocos2d classes
#import "cocos2d.h"

// HelloWorldLayer
@interface HelloWorldLayer : CCLayer
{
    CCTMXTiledMap *theMap;
    CCTMXLayer *bounds;
    CCTMXLayer *bgLayer;

}
@property (nonatomic,retain) CCTMXTiledMap *theMap;
@property (nonatomic,retain) CCTMXLayer *bounds;
@property (nonatomic,retain) CCTMXLayer *bgLayer;


// returns a CCScene that contains the HelloWorldLayer as the only child
+(CCScene *) scene;

@end
这是HelloWorldlayer.m

//
//  HelloWorldLayer.m
//  game
//
//  Created by Alex Reichenbach on 9/29/12.
//  Copyright __MyCompanyName__ 2012. All rights reserved.
//


// Import the interfaces
#import "HelloWorldLayer.h"

// HelloWorldLayer implementation
@implementation HelloWorldLayer
@synthesize theMap;
@synthesize bgLayer;
@synthesize bounds;

+(CCScene *) scene
{
    // 'scene' is an autorelease object.
    CCScene *scene = [CCScene node];

    // 'layer' is an autorelease object.
HelloWorldLayer *layer = [HelloWorldLayer node];

// add layer as a child to scene
[scene addChild: layer];

// return the scene
return scene;
}

// on "init" you need to initialize your instance
-(id) init
{
    // always call "super" init
    // Apple recommends to re-assign "self" with the "super" return value
    if( (self=[super init])) {


        self.theMap = [CCTMXTiledMap tiledMapWithTMXFile:@"game.tmx"];
        self.bgLayer = [theMap layerNamed:@"bg"];

        self.bounds = [_theMap layerNamed:@"by"];

        [self addChild:theMap z:-1];


}
return self;
}

// on "dealloc" you need to release all your retained objects
- (void) dealloc
{
    self.theMap = nil;
    self.bgLayer = nil;
    self.bounds = nil;
[super dealloc];
}
@end
这是平铺程序

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="32" height="54" tilewidth="10" tileheight="10">
 <tileset firstgid="1" name="Solid_blue" tilewidth="10" tileheight="10">
  <image source="Solid_blue.PNG" width="200" height="200"/>
 </tileset>
 <tileset firstgid="401" name="Light_green" tilewidth="10" tileheight="10">
  <image source="Light_green.png" width="300" height="300"/>
 </tileset>
 <layer name="bg" width="32" height="54">
  <data encoding="base64" compression="zlib">
   eJzt1bENACAMA7DwW/8XJ3EBrAXkwXukRmklKQC4yBz9GXBLAGDPjwd+YMt4nQ7D2QL3vs3R
  </data>
 </layer>
</map>

eJzt1bENACAMA7DwW/8XJ3EBRAXKWXUKMKLKQC4YBZ9GXBLAGDPJWD+YMt4nQ7D2QL3vs3R

您发布的文件中没有名为“by”的图层。您是否在该行收到该错误?

您需要显示收到SIGBRT的行。还有控制台输出。通常使用cocos2d时,它无法加载您的一个资源。
self.bounds = [_theMap layerNamed:@"by"];