ios5 - Unable to download data in Background after 10 minutes? -
i working app in want download data in background. per apple multitasking guidelines, allowed download data 10 minutes.
in case, take more 10 minutes downloading file , downloading failed.
initial downloading request downloadviewcontroller below.
- (ibaction)performlargeupload:(id)sender { [request cancel]; [self setrequest:[asiformdatarequest requestwithurl:[nsurl urlwithstring:@"http://mirrorblender.top-ix.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_stereo.avi"]]]; // 149mb [request setdownloaddestinationpath:[[nshomedirectory() stringbyappendingpathcomponent:@"documents"] stringbyappendingpathcomponent:@"big_buck_bunny_480p_stereo.avi"]]; [request settimeoutseconds:20]; [request setdownloadprogressdelegate:progressindicator]; [request setuserinfo:[nsdictionary dictionarywithobject:@"request1" forkey:@"name"]]; #if __iphone_os_version_max_allowed >= __iphone_4_0 [request setshouldcontinuewhenappentersbackground:yes]; #endif [request setdelegate:self]; [request setdidfailselector:@selector(uploadfailed:)]; [request setdidfinishselector:@selector(uploadfinished:)]; [request setallowresumeforfiledownloads:yes]; [request startasynchronous]; [resultview settext:@"downloading data..."]; } in appdelegate, have put code when applicationdidenterbackground
- (void)applicationdidenterbackground:(uiapplication *)application { uiapplication *app = [uiapplication sharedapplication]; uibackgroundtaskidentifier bgtask; bgtask = [app beginbackgroundtaskwithexpirationhandler:^{ [app endbackgroundtask:bgtask]; }]; backgroundtimer=nil; backgroundtimer = [nstimer scheduledtimerwithtimeinterval:10 target:self selector:@selector(keepalive) userinfo:nil repeats:yes]; } how extend time background downloading??
you can't it. stop trying.
Comments
Post a Comment