I am creating an IOS game with socket IO and node js in the background with megabits socket for the IOS client. I have a 100ms timer that ticks and updates the clients' timer in that interval. I have an IOS7 iPhone 5 in which it works spectacular. However, the IOS8 iPhone5s the millisecond interval seems to act weird. It seems to hang for 800 ms, then quickly tick 0-10 in 200 ms instead of evenly distributing the tick. this is the code I am using when I receive them time from the server.
My questions are as follows:
is 100ms updates too fast for a socket client? I was reading through some game makers' node stuff and it seems to stream every 30ms so I didn't think it was an issue.
I have seven apps out , and every one of them broke for IOS 8. is there a different way to do this in IOS8 that would be more efficient/ should I use something rather than dispatch to run on a diff thread?
I should note running on main/background thread made no difference. It is weird that all my IOS7 devices work fine, and this problem only occurs on IOS 8.
[SIOSocket socketWithHost: @"host" response: ^(SIOSocket *socket)
{
self.socket = socket;
__weak typeof(self) weakSelf = self;
self.socket.onConnect = ^()
{
if(ftick)
{
[weakSelf addToPool];
NSLog(@"@@@");
ftick = NO;
}
};
[self.socket on: @"upTimerClicked" callback: ^(id time_left)
{
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(queue, ^{
incrementer++;
if(incrementer > 9)
{
incrementer = 0;
gameScore++;
gameScreen.score = gameScore;
NSLog(@"up timer clicked %d",incrementer);
}
dispatch_async(dispatch_get_main_queue(), ^{
incrementers++;
NSDictionary *tleft = time_left;
NSString *hr = [tleft objectForKey:@"hours"];
NSString *min = [tleft objectForKey:@"mins"];
NSString *sec = [tleft objectForKey:@"secs"];
NSString *mil = [tleft objectForKey:@"millis"];
NSLog(@"up timer clicked %d",incrementers);
NSString *formattedTime = [NSString stringWithFormat:@"%@:%@:%@:%d",hr,min,sec,[mil intValue]/2];
[gameScreen tickCountUpTimer:formattedTime];
});
}];
Thank you in advance.