2

I am currently experiencing some strange behavior when mixing cocos2d with UIKit. I've been tracking the zombies and it's always an overrelease that triggers the crashes. Now I know this is vague so I'll sketch a scenario where this happens in detail when using a native uikit object.

I have this piece of code :

// I create a new UIActivityViewController and present it on my appDelegate viewController

    self.activityViewController = [[UIActivityViewController alloc] initWithActivityItems:[NSArray arrayWithObjects:tempImage, nil]
                                                                                         applicationActivities:nil];

    [[appDelegate viewController] presentViewController:self.activityViewController
                                                                 animated:YES
                                                               completion:nil];

The first time I call this it works, the viewController comes on, and I can dismiss. The second time I try to create a new ActivityController it crashes.

Now this also appears to be the case when removing a UIViewController subclass, and then starting CCDirector that contains UIKit elements. The strange thing is that I get the overrelease on properties of the first UIViewController, which I don't when not switching to a cocos2D scene.

I am running cocos2D in a project using ARC, not using ARC is not an option.

If anyone has had such problems and can point me into the right direction please do.

Thanks !

ekinsol
  • 501
  • 1
  • 3
  • 9
  • The description is vague, nothing to go on here. One common problem is starting/stopping cocos2d. It was never really designed to shut down, and developers frequently have issues with that. I suggest keeping cocos2d alive, just send director stop/startAnimation messages, don't try to release the cocos2d view or call the director's end method. – CodeSmile Oct 26 '12 at 14:14
  • Well I've been starting/stopping cocos2D for 2 years now ever since the 0.9x versions. It does not show this behavior on iOS5x nor below. I will try your suggestion out in the hope this could be an issue on iOS6. – ekinsol Oct 26 '12 at 18:49

0 Answers0