Game Center lag with Memory Warning

253 Views Asked by At

I have almost finished an iPhone game made with cocos2d 2.0, and the last thing I did was add Game Center. I am using an iPod 4 for testing. I followed this tutorial: http://www.raywenderlich.com/23189/whats-new-with-game-center-in-ios-6

The problem is that when I try to submit a score to Game Center, the game starts to stutter / lag like crazy for 5-10 seconds. This happens when I call the following:

[gkScore reportScoreWithCompletionHandler:
 ^(NSError* error) {

     [self setLastError:error];

     BOOL success = (error == nil);

     if ([_delegate
          respondsToSelector:
          @selector(onScoresSubmitted:)]) {

         [_delegate onScoresSubmitted:success];
     }
 }];

The score is sent successfully without errors, but the game lags a lot when sending and memory warnings appear in the console. This problem seems to be related to a "CONNECTION INTERRUPTED" message that appears in the console beforehand, that seems to occur when the game's memory usage is around 60MB. The game doesn't lag when I try submitting a score earlier, before that message appears.

I searched around and found it strange that nobody else seems to complain about this, is this normal? Any help is much appreciated, thanks!

0

There are 0 best solutions below