Objective c XCode项目生成错误。libsystem\u kernel.dylib`\u pthread\u kill:

Objective c XCode项目生成错误。libsystem\u kernel.dylib`\u pthread\u kill:,objective-c,xcode,Objective C,Xcode,这是我的密码 #import "HelloWorldLayer.h" #import "AppDelegate.h" @implementation HelloWorldLayer + (id)scene { CCScene *scene = [CCScene node]; HelloWorldLayer *layer = [HelloWorldLayer node]; [scene addChild:layer]; return scene; } -

这是我的密码

#import "HelloWorldLayer.h"

#import "AppDelegate.h"

@implementation HelloWorldLayer

+ (id)scene {
    CCScene *scene = [CCScene node];

    HelloWorldLayer *layer = [HelloWorldLayer node];
    [scene addChild:layer];

    return scene;
}

- (id)init
{
    self = [super init];
    if (self) {

        CGSize winSize = [CCDirector sharedDirector].winSize;

        [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile:
         @"wallpaper_UntitledSheet.plist"];     

        CCSpriteBatchNode *spriteSheet = [CCSpriteBatchNode batchNodeWithFile:@"wallpaper_UntitledSheet.pvr.ccz"];
        [self addChild:spriteSheet];

        CCSprite *sprite = [CCSprite spriteWithSpriteFrameName:@"wallpaper.png"];
        sprite.position = ccp(winSize.height/2,winSize.width/2);
        [spriteSheet addChild:sprite];

 }
    return self;

}
生成日志:

cocos2d: cocos2d-iphone v2.1
cocos2d: compiled with Profiling Support: NO
cocos2d: OS version: 7.1 (0x07010000)
cocos2d: GL_VENDOR:   Apple Computer, Inc.
cocos2d: GL_RENDERER: Apple Software Renderer
cocos2d: GL_VERSION:  OpenGL ES 2.0 APPLE-9.4.1
cocos2d: GL_MAX_TEXTURE_SIZE: 4096
cocos2d: GL_MAX_TEXTURE_UNITS: 8
cocos2d: GL_MAX_SAMPLES: 4
cocos2d: GL supports PVRTC: YES
cocos2d: GL supports BGRA8888 textures: YES
cocos2d: GL supports NPOT textures: YES
cocos2d: GL supports discard_framebuffer: YES
cocos2d: GL supports shareable VAO: NO
2014-01-29 18:59:38.443 ImmunesWar[1170:70b] Retina Display Not supported
2014-01-29 18:59:38.930 ImmunesWar[1170:70b] cocos2d: animation started with frame interval: 60.00
2014-01-29 18:59:38.933 ImmunesWar[1170:70b] cocos2d: surface size: 1024x768
2014-01-29 18:59:39.579 ImmunesWar[1170:70b] cocos2d: CCSpriteFrameCache: Frame 'wallpaper.png' not found
2014-01-29 18:59:39.581 ImmunesWar[1170:70b] *** Assertion failure in +[CCSprite spriteWithSpriteFrameName:], /Users/admin/Desktop/ImmunesWar/ImmunesWar/libs/cocos2d/CCSprite.m:105
2014-01-29 18:59:39.660 ImmunesWar[1170:70b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Invalid spriteFrameName: wallpaper.png'
*** First throw call stack:
(
    0   CoreFoundation                      0x02d35c94 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x023e38b6 objc_exception_throw + 44
    2   CoreFoundation                      0x02d35af8 +[NSException raise:format:arguments:] + 136
    3   Foundation                          0x01ae31ae -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116
    4   ImmunesWar                          0x00082b2e +[CCSprite spriteWithSpriteFrameName:] + 270
    5   ImmunesWar                          0x000bf297 -[HelloWorldLayer init] + 455
    6   ImmunesWar                          0x0012d385 +[CCNode node] + 69
    7   ImmunesWar                          0x000befdc +[HelloWorldLayer scene] + 92
    8   ImmunesWar                          0x000f88b1 -[IntroLayer onEnter] + 145
    9   libobjc.A.dylib                     0x023f57d2 -[NSObject performSelector:] + 62
    10  ImmunesWar                          0x00034af9 ccArrayMakeObjectsPerformSelector + 89
    11  ImmunesWar                          0x0007a22a -[CCArray makeObjectsPerformSelector:] + 58
    12  ImmunesWar                          0x0012fea4 -[CCNode onEnter] + 68
    13  ImmunesWar                          0x000b5b42 -[CCDirector setNextScene] + 418
    14  ImmunesWar                          0x00118608 -[CCDirectorIOS drawScene] + 296
    15  Foundation                          0x01b526ef -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:modes:] + 863
    16  Foundation                          0x01b8cd19 -[NSObject(NSThreadPerformAdditions) performSelector:onThread:withObject:waitUntilDone:] + 138
    17  ImmunesWar                          0x00118d9c -[CCDirectorIOS runWithScene:] + 540
    18  ImmunesWar                          0x000b7f0f -[MyNavigationController directorDidReshapeProjection:] + 127
    19  ImmunesWar                          0x001194e8 -[CCDirectorIOS reshapeProjection:] + 440
    20  ImmunesWar                          0x000bcf39 -[CCGLView layoutSubviews] + 249
    21  UIKit                               0x00448354 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 355
    22  libobjc.A.dylib                     0x023f581f -[NSObject performSelector:withObject:] + 70
    23  QuartzCore                          0x013df6ae -[CALayer layoutSublayers] + 148
    24  QuartzCore                          0x013d349c _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 380
    25  QuartzCore                          0x013df5f9 -[CALayer layoutIfNeeded] + 160
    26  UIKit                               0x005096c3 -[UIViewController window:setupWithInterfaceOrientation:] + 304
    27  UIKit                               0x00420417 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:isRotating:] + 5212
    28  UIKit                               0x0041efb6 -[UIWindow _setRotatableClient:toOrientation:updateStatusBar:duration:force:] + 82
    29  UIKit                               0x0041ee88 -[UIWindow _setRotatableViewOrientation:updateStatusBar:duration:force:] + 117
    30  UIKit                               0x0041ef10 -[UIWindow _setRotatableViewOrientation:duration:force:] + 67
    31  UIKit                               0x0041dfaa __57-[UIWindow _updateToInterfaceOrientation:duration:force:]_block_invoke + 120
    32  UIKit                               0x0041df0c -[UIWindow _updateToInterfaceOrientation:duration:force:] + 400
    33  UIKit                               0x0041ec63 -[UIWindow setAutorotates:forceUpdateInterfaceOrientation:] + 870
    34  UIKit                               0x00422256 -[UIWindow setDelegate:] + 449
    35  UIKit                               0x004fb757 -[UIViewController _tryBecomeRootViewControllerInWindow:] + 180
    36  UIKit                               0x00417de4 -[UIWindow addRootViewControllerViewIfPossible] + 591
    37  UIKit                               0x00417f5f -[UIWindow _setHidden:forced:] + 312
    38  UIKit                               0x004181db -[UIWindow _orderFrontWithoutMakingKey] + 49
    39  UIKit                               0x00422d38 -[UIWindow makeKeyAndVisible] + 65
    40  ImmunesWar                          0x000b8503 -[AppController application:didFinishLaunchingWithOptions:] + 1507
    41  UIKit                               0x003d3cc7 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 309
    42  UIKit                               0x003d4619 -[UIApplication _callInitializationDelegatesForURL:payload:suspended:] + 1810
    43  UIKit                               0x003d9189 -[UIApplication _runWithURL:payload:launchOrientation:statusBarStyle:statusBarHidden:] + 824
    44  UIKit                               0x003ed8d2 -[UIApplication handleEvent:withNewEvent:] + 3517
    45  UIKit                               0x003ede95 -[UIApplication sendEvent:] + 85
    46  UIKit                               0x003dad70 _UIApplicationHandleEvent + 683
    47  GraphicsServices                    0x03ab8bd6 _PurpleEventCallback + 776
    48  GraphicsServices                    0x03ab86e1 PurpleEventCallback + 46
    49  CoreFoundation                      0x02cb1485 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 53
    50  CoreFoundation                      0x02cb11bb __CFRunLoopDoSource1 + 523
    51  CoreFoundation                      0x02cdbe9c __CFRunLoopRun + 2156
    52  CoreFoundation                      0x02cdb1e3 CFRunLoopRunSpecific + 467
    53  CoreFoundation                      0x02cdaffb CFRunLoopRunInMode + 123
    54  UIKit                               0x003d88be -[UIApplication _run] + 840
    55  UIKit                               0x003daabb UIApplicationMain + 1225
    56  ImmunesWar                          0x0012d316 main + 134
    57  libdyld.dylib                       0x0299070d start + 1
    58  ???                                 0x00000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 
当我构建这个项目时,我会收到错误


您没有得到生成错误,而是得到运行时错误

您遇到的运行时错误是您的应用程序中没有绑定文件名wallpar.png


您需要确保wallpar.png是项目的一部分,并且与应用程序捆绑在一起。

在屏幕截图中,调试器控制台中显示了原因。有些例外,但并非所有例外都可见。看看你撞车的原因,你能帮我吗?我只是个初学者。我不知道如何解决这个问题。谢谢将崩溃的原因添加到您的帖子中,这样会更容易得到帮助。原因在Xcode窗口右下角的调试器控制台输出中给出。使用nszombie,它将有助于符号化崩溃。如何使用这个-我添加了类似nszombie的示例,但错误仍然存在。感谢所有人的帮助,我更正了一个错误。我插入了墙纸而不是wallper.png。这是我的错误