Created
November 24, 2009 02:30
-
-
Save ejknapp/241581 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// How to poll | |
// Property | |
NSTimer *keepLoggedInTimer; | |
// Methods | |
- (void)keepLoginAlive:(NSTimer *)timer; | |
- (void)startTimerForKeepAlive; | |
// Start method | |
#pragma mark Keep Login Alive | |
- (void)startTimerForKeepAlive { | |
// NSLog(@"In startTimerForKeepAlive"); | |
NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; | |
NSTimer *keepAliveTimer = | |
[NSTimer scheduledTimerWithTimeInterval:180 | |
target:self | |
selector:@selector(keepLoginAlive:) | |
userInfo:nil | |
repeats:YES]; | |
[runLoop addTimer:keepAliveTimer forMode:NSDefaultRunLoopMode]; | |
self.keepLoggedInTimer = keepAliveTimer; | |
} | |
// Method called by timer | |
- (void)keepLoginAlive:(NSTimer *)timer { | |
BOOL isAlive = [self.serverManager testForFlakServer:hostURL]; | |
// NSLog(@"In keepLoginAlive: %@", [timer fireDate]); | |
if (!isAlive) { | |
[self.serverManager createSession]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment