gksession

calling a method after each 60 seconds in iPhone

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-28 05:18:16
I have created an GKSession and as its object is created, it starts search for availability of devices, as - (void)session:(GKSession *)session peer:(NSString *)peerID didChangeState:(GKPeerConnectionState)state { I want to call this method after each 60 seconds, what should I do? Use NSTimer NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval: 60.0 target: self selector: @selector(callAfterSixtySecond:) userInfo: nil repeats: YES]; After each 60.0 second , iOS will call the below function -(void) callAfterSixtySecond:(NSTimer*) t { NSLog(@"red"); } Once you set NSTimer to

calling a method after each 60 seconds in iPhone

元气小坏坏 提交于 2019-11-27 05:32:29
问题 I have created an GKSession and as its object is created, it starts search for availability of devices, as - (void)session:(GKSession *)session peer:(NSString *)peerID didChangeState:(GKPeerConnectionState)state { I want to call this method after each 60 seconds, what should I do? 回答1: Use NSTimer NSTimer* myTimer = [NSTimer scheduledTimerWithTimeInterval: 60.0 target: self selector: @selector(callAfterSixtySecond:) userInfo: nil repeats: YES]; After each 60.0 second , iOS will call the below