2

this is my code.

#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;

}

Build log:

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) 

When i build this project, I receive errors

http://pixs.ru/showimage/Snimokekra_1695412_10662485.png

Mualig
  • 1,444
  • 1
  • 19
  • 42
user3243304
  • 53
  • 1
  • 7
  • 1
    in your screenshot a reason is seen in the debugger console. Some exception, but not all is visible. look there for the reason of your crash. – Volker Jan 29 '14 at 14:12
  • can you help me? i'm just beginner. and i don't know, how to solve this problem. thanks – user3243304 Jan 29 '14 at 14:19
  • add the reason of the crash to your post and it will be easier to help. The reason is given in the debugger console output in the lower right part of your Xcode window. – Volker Jan 29 '14 at 14:23
  • use nszombie, it will help in symbolicate your crash. How to use this - http://stackoverflow.com/questions/2190227/how-do-i-set-up-nszombieenabled-in-xcode-4 – rishi Jan 29 '14 at 14:26
  • i added nszombie like example,but error are still. – user3243304 Jan 29 '14 at 14:43

1 Answers1

2

You are not getting build errors, you are getting runtime errors.

The runtime error you are getting is there is no file name wallpaper.png bundled with your app.

You need to make sure that wallpaper.png is part of your project and that it's being bundled with your application.

Jeffery Thomas
  • 42,202
  • 8
  • 92
  • 117
  • thanks to all for the help, I corrected an error. I inserted wallpaper instead of wallpaper.png. this is my mistake – user3243304 Jan 29 '14 at 14:51