{"id":6135,"date":"2014-04-13T04:33:46","date_gmt":"2014-04-13T04:33:46","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/cocos2d-app-crash-invalid-spriteframename-collection-of-common-programming-errors-2\/"},"modified":"2014-04-13T04:33:46","modified_gmt":"2014-04-13T04:33:46","slug":"cocos2d-app-crash-invalid-spriteframename-collection-of-common-programming-errors-2","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/04\/13\/cocos2d-app-crash-invalid-spriteframename-collection-of-common-programming-errors-2\/","title":{"rendered":"Cocos2d app crash, invalid spriteFrameName-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m trying to develop an iphone game with cocos2d and I&#8217;m a beginner. I have some problems trying to show the number of lives in the upper boundary of the screen. So I want to start with 3 lives and decrease one of them at each error. This is my code<\/p>\n<pre><code>-(void)life {\n    NSMutableArray *position = [NSMutableArray\n                                arrayWithObjects:@\"460\", @\"440\", @\"420\", nil];\n    spriteLifeArray = [[NSMutableArray alloc] init];\n    for (int i = 0; i 1) { \/\/ 1\n            life = life - 1;\n            for (CCSprite *spr in spriteLifeArray) {\n                if (life == spr.tag) {\n                    [self removeChild:spr cleanup:YES];\n                    [self actionBlink];\n                }\n            }\n        } else { \n            \/\/  partita persa\n        }\n    }\n}\n<\/code><\/pre>\n<p>A file named &#8220;cuore.png&#8221; exists in the Resources Folder, But when I try to compile, after the splashscreen the app crashes. This is the log:<\/p>\n<blockquote>\n<p>2013-02-11 19:55:06.635 QuizGame[6672:c07] cocos2d: cocos2d v1.0.1 2013-02-11 19:55:06.636 QuizGame[6672:c07] cocos2d: Using Director Type:CCDirectorDisplayLink 2013-02-11 19:55:06.664 QuizGame[6672:c07] cocos2d: OS version: 6.1 (0x06010000) 2013-02-11 19:55:06.664 QuizGame[6672:c07] cocos2d: GL_VENDOR: Apple Computer, Inc. 2013-02-11 19:55:06.665 QuizGame[6672:c07] cocos2d: GL_RENDERER: Apple Software Renderer 2013-02-11 19:55:06.666 QuizGame[6672:c07] cocos2d: GL_VERSION: OpenGL ES-CM 1.1 APPLE 2013-02-11 19:55:06.667 QuizGame[6672:c07] cocos2d: GL_MAX_TEXTURE_SIZE: 4096 2013-02-11 19:55:06.667 QuizGame[6672:c07] cocos2d: GL_MAX_MODELVIEW_STACK_DEPTH: 16 2013-02-11 19:55:06.667 QuizGame[6672:c07] cocos2d: GL_MAX_SAMPLES: 4 2013-02-11 19:55:06.668 QuizGame[6672:c07] cocos2d: GL supports PVRTC: YES 2013-02-11 19:55:06.668 QuizGame[6672:c07] cocos2d: GL supports BGRA8888 textures: YES 2013-02-11 19:55:06.669 QuizGame[6672:c07] cocos2d: GL supports NPOT textures: YES 2013-02-11 19:55:06.670 QuizGame[6672:c07] cocos2d: GL supports discard_framebuffer: YES 2013-02-11 19:55:06.670 QuizGame[6672:c07] cocos2d: compiled with NPOT support: NO 2013-02-11 19:55:06.671 QuizGame[6672:c07] cocos2d: compiled with VBO support in TextureAtlas : YES 2013-02-11 19:55:06.671 QuizGame[6672:c07] cocos2d: compiled with Affine Matrix transformation in CCNode : YES 2013-02-11 19:55:06.672 QuizGame[6672:c07] cocos2d: compiled with Profiling Support: NO 2013-02-11 19:55:06.695 QuizGame[6672:c07] cocos2d: CCSpriteFrameCache: Frame &#8216;cuore.png&#8217; not found 2013-02-11 19:55:06.695 QuizGame[6672:c07] <strong>* Assertion failure in +[CCSprite spriteWithSpriteFrameName:], \/Users\/alexbava\/Desktop\/QuizGame\/QuizGame\/libs\/cocos2d\/CCSprite.m:110 2013-02-11 19:55:06.696 QuizGame[6672:c07]<\/strong> Terminating app due to uncaught exception &#8216;NSInternalInconsistencyException&#8217;, reason: &#8216;Invalid spriteFrameName: cuore.png&#8217; ** First throw call stack: (0x2074012 0x1ca4e7e 0x2073e78 0x14e7665 0x6564e 0xc2bd7 0xc3229 0x40261 0xc1c4d 0xc12ec 0x9931af 0x9937a1 0x99494b 0x9a5cb5 0x9a6beb 0x998698 0x2d7cdf9 0x2d7cad0 0x1fe9bf5 0x1fe9962 0x201abb6 0x2019f44 0x2019e1b 0x99417a 0x995ffc 0xc0dcf 0x2665) libc++abi.dylib: terminate called throwing an exception (lldb)<\/p>\n<\/blockquote>\n<p>I think I&#8217;ve made a stupid error or something missing. Can anyone help me please?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying to develop an iphone game with cocos2d and I&#8217;m a beginner. I have some problems trying to show the number of lives in the upper boundary of the screen. So I want to start with 3 lives and decrease one of them at each error. This is my code -(void)life { NSMutableArray *position [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6135","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6135","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6135"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6135\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6135"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6135"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6135"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}