reading a lot about how to prevent iphone goingto sleep while running my app I am very unhappy at the moment because nothing worked..
here I read about the idea to set up a timer for every 30 seconds to set the idleTimerDisabled to NO and then YES, but my objC isn't that good yet. could anybody tell me how (and where)?
thnx!
edit: here is the code I tried:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
[ super applicationDidFinishLaunching:application ];
//application.idleTimerDisabled = NO;
//application.idleTimerDisabled = YES;
//[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
[UIApplication sharedApplication].idleTimerDisabled = NO;
[UIApplication sharedApplication].idleTimerDisabled = YES;
}
edit2: after that I tried to start a loop with:
-(void)_timerLoop
{
// add this function up the top. it's what will happen when the
// timer goes off:
NSLog(@"Your timer went off!!!");
}
/**
* This is main kick off after the app inits, the views and Settings are setup here.
*/
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
[ super applicationDidFinishLaunching:application ];
//application.idleTimerDisabled = NO;
//application.idleTimerDisabled = YES;
//[[UIApplication sharedApplication] setIdleTimerDisabled:YES];
//[UIApplication sharedApplication].idleTimerDisabled = NO;
//[UIApplication sharedApplication].idleTimerDisabled = YES;
[NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(_timerLoop) userInfo:nil repeats:YES];
}
edit3: you really can't change accidentially downvotes? would be a nice chnage request to the stackoverflow system!