I have been struggling with this for days, for some reason my SKScenes are not deallocating correctly, this results in bounded memory growth as each time i exit and enter a
I could be wrong but I suspect your button class is your offender. When you call...
[testButton4 addTarget:self selector:@selector(buttonPressed:) withObject:[NSNumber numberWithInt:5] forControlEvent:AGButtonControlEventTouchUpInside];
You pass self being that scene. In the button class the method..
-(void)addTarget:(id)target selector:(SEL)selector withObject:(id)object forControlEvent:(AGButtonControlEvent)controlEvent
{
//check whether selector is already saved, otherwise it will get called twice
if (marrSelectors == nil)
{
marrSelectors = [NSMutableArray new];
}
NSMutableDictionary *mdicSelector = [[NSMutableDictionary alloc]init];
[mdicSelector setObject:target forKey:@"target"];
[mdicSelector setObject:[NSValue valueWithPointer:selector] forKey:@"selector"];
if (object)
{
[mdicSelector setObject:object forKey:@"object"];
}
[mdicSelector setObject:[NSNumber numberWithInt:controlEvent] forKey:@"controlEvent"];
[marrSelectors addObject:mdicSelector];
}
Note this..
[mdicSelector setObject:target forKey:@"target"];
target is your scene and it is being tossed into a dictionary in that is tossed into an array. So in theory that button now has a strong reference to your scene and your scene has a reference to that button.
To test this theory set all of your buttons to nil before calling
[self.view presentScene:theScene transition:theTransition];
And if I am correct that should break the strong reference to each other. Hopefully that helps and is the issue.