in 3g [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; is not working sometimes

StackOverflow https://stackoverflow.com/questions/11573582

  •  22-06-2021
  •  | 
  •  

I am working on a application which upload images and videos to server. User can create a queue and upload files so it will take a lot of time to finish uploading, so while uploading we set the idle timer disabled to true

[[UIApplication sharedApplication] setIdleTimerDisabled:YES];

  But problem is that its working fine in WiFi network but sometimes its not working when i am in 3G network. Is apple overriding this call because 3G consumes more battery? If so can I stop the screen from sleeping.

My requirement is that the videos should continue upload even on 3G Thanks in advance,

有帮助吗?

解决方案

At last i solved this issue by calling below function every 10 second.

-(void) sleepModeDisable{
    [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
    [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top