read a lot about how to prevent iphone that will sleep when working with my application. I am very unhappy at the moment because nothing is working.
here I read the idea of creating a timer every 30 seconds to set idleTimerDisabled to NO and then YES, but my objC is not so good though. can someone tell me how (and where)?
Thnx!
edit: here is the code I tried:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
[ super applicationDidFinishLaunching:application ];
[UIApplication sharedApplication].idleTimerDisabled = NO;
[UIApplication sharedApplication].idleTimerDisabled = YES;
}
edit2: after that I tried to run the loop with
-(void)_timerLoop
{
NSLog(@"Your timer went off!!!");
}
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
[ super applicationDidFinishLaunching:application ];
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(_timerLoop) userInfo:nil repeats:YES];
}
edit3: you really can't accidentally change descending points? would be a good chanage request for a stackoverflow system!
source
share