Guys, i get some random errors now in my game, at the Director loop? What i'm doing wrong? Or how i can get more information, about what is crashing my app?
Errors at Director Mainloop?
(10 posts) (2 voices)-
Posted 2 years ago #
-
it seems that it is trying to call an scheduled method, but the name is given name was incorrect.
probably you missed the:in the name.check for:
[self schedule:@selector(mySchedule)]; // WRONGInstead, it should be:
[self schedule:@selector(mySchedule:)]; // OK. Notice the ':'Posted 2 years ago # -
@riq i double checked this before! I just cleanup the autorelease from actions, and now stop crash! Can be that @riq?
Posted 2 years ago # -
@riq the problem still ocorrent, i don't know exactly what part of the code i must post to undestand what i'm doing wrong, i have one loading scene, and when i call the new scene, like score screen, i get this errors random, the the exaclty point of error is here:
-(void) fire: (ccTime) dt { if( elapsed == - 1) elapsed = 0; else elapsed += dt; if( elapsed >= interval ) { impMethod(target, selector, elapsed); elapsed = 0; } }I Keep looking, probably is something i mess up. if if found something I post here!
Posted 2 years ago # -
@riq, its the autorelease crashing my game, looke at this:
-(void) showUpItens { id showItem1 = [[Sequence actions: [ScaleTo actionWithDuration:0.2 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil] autorelease]; id showItem2 = [[Sequence actions: [ScaleTo actionWithDuration:0.4 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil] autorelease]; id showItem3 = [[Sequence actions: [ScaleTo actionWithDuration:0.2 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil] autorelease]; id showItem4 = [[Sequence actions: [ScaleTo actionWithDuration:0.4 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil] autorelease]; id showItem5 = [[Sequence actions: [ScaleTo actionWithDuration:0.5 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil] autorelease]; id showItem6 = [[Sequence actions: [ScaleTo actionWithDuration:0.6 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil] autorelease]; id showItem7 = [[Sequence actions: [ScaleTo actionWithDuration:0.7 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil] autorelease]; [as_height setVisible:true]; [as_boxes setVisible:true]; [as_trace setVisible:true]; [as_score setVisible:true]; [height_fontAtlas setVisible:true]; [boxes_fontAtlas setVisible:true]; [score_fontAtlas setVisible:true]; [as_height runAction:showItem1]; [height_fontAtlas runAction:showItem2]; [as_boxes runAction:showItem3]; [boxes_fontAtlas runAction:showItem4]; [as_trace runAction:showItem5]; [as_score runAction:showItem6]; [score_fontAtlas runAction:showItem7]; }If i using like that i get crash, just take of the autorelease and no errors:
-(void) showUpItens { id showItem1 = [Sequence actions: [ScaleTo actionWithDuration:0.2 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil]; id showItem2 = [Sequence actions: [ScaleTo actionWithDuration:0.4 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil]; id showItem3 = [Sequence actions: [ScaleTo actionWithDuration:0.2 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil]; id showItem4 = [Sequence actions: [ScaleTo actionWithDuration:0.4 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil]; id showItem5 = [Sequence actions: [ScaleTo actionWithDuration:0.5 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil]; id showItem6 = [Sequence actions: [ScaleTo actionWithDuration:0.6 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil]; id showItem7 = [Sequence actions: [ScaleTo actionWithDuration:0.7 scale:0.0], [EaseElasticOut actionWithAction:[ScaleTo actionWithDuration:1.0 scale:1.0]], nil]; [as_height setVisible:true]; [as_boxes setVisible:true]; [as_trace setVisible:true]; [as_score setVisible:true]; [height_fontAtlas setVisible:true]; [boxes_fontAtlas setVisible:true]; [score_fontAtlas setVisible:true]; [as_height runAction:showItem1]; [height_fontAtlas runAction:showItem2]; [as_boxes runAction:showItem3]; [boxes_fontAtlas runAction:showItem4]; [as_trace runAction:showItem5]; [as_score runAction:showItem6]; [score_fontAtlas runAction:showItem7]; }I know, you probably must reply things like that all the time, but if you can help me understand this, i ill be very happy:
What i must release? If i have one Sprite* declared at my .h file, without @property/@@synthesize, i must release that? Even if i not retain it? And in some spots i read about set mySprite = nil; in the dealloc, everytime? or just when i retain?
When i must call: [[TextureMgr sharedTextureMgr] removeAllTextures]; and [[TextureMgr sharedTextureMgr] removeUnusedTextures];? This clean my memory? If i call something like that propably in the Activity Monitor, i see the memory drops right?
Sorry about that, but i almost done to release my app, and just want do things right!
Posted 2 years ago # -
yes, the autorelease should not be there.
[Sequence ...];already returns an autoreleased object.I suggest reading this PDF:
http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.htmlIt is a MUST read for every objective-c programmer.
Posted 2 years ago # -
@riq thanks! Reading now!
Just about the [[TextureMgr sharedTextureMgr] removeAllTextures]; and [[TextureMgr sharedTextureMgr] removeUnusedTextures];
[[TextureMgr sharedTextureMgr] removeAllTextures]; use is whenever one scene call dealloc right?
And
[[TextureMgr sharedTextureMgr] removeUnusedTextures]; is in memory warning right?Posted 2 years ago # -
It is safe to use
[[TextureMgr sharedTextureMgr] removeUnusedTextures];in memory warnings.Regarding
[[TextureMgr sharedTextureMgr] removeAllTextures];.... mmm... it depends on your game. If the next scene is going to use more or less the same textures, then I wouldn't remove them.Posted 2 years ago # -
@riq thanks riq! Thanks for everything, can you post one email, of your contact? I want send to you some promocode!
Posted 2 years ago #
Reply
You must log in to post.
