Search code examples
iphoneiosiphone-3g

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


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,


Solution

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

    -(void) sleepModeDisable{
        [[UIApplication sharedApplication] setIdleTimerDisabled:NO];
        [[UIApplication sharedApplication] setIdleTimerDisabled:YES];
    }