iphone - multiple image uploading to server using soap based web service -
i trying run image uploading using soap based web service , doing face 2 key issue in app.
issue 1:- when app uploading multiple images server , @ time if application goes in background state @ time stop executing (application suspended state)
. when app goes background foreground state again resume background thread.
issue 2:- when try upload 160-170 images on server device gallery. received memory warning after uploading 60-70 images on server. handle method , try free memory within application , again start thread @ time application crashed. //->> 2nd issue add 3 different web service , long code not going share here. when check on instrument run on max 2 2.5 mb in live bytes when uploading thread start gradually increasing , @ pick point received received memory warning. code contains feature of arc still got memory warning issue.
code issue 1:-
- (void)applicationdidenterbackground:(uiapplication *)application { uidevice* device = [uidevice currentdevice]; bool backgroundsupported = no; if ([device respondstoselector:@selector(ismultitaskingsupported)]) { backgroundsupported = device.multitaskingsupported; } //nslog(@"backgroundsupported: %d", backgroundsupported); if (backgroundsupported) { _isbackground = true; uiapplication* app = [uiapplication sharedapplication]; bgtask = [app beginbackgroundtaskwithexpirationhandler: ^{ [app endbackgroundtask:bgtask]; bgtask = uibackgroundtaskinvalid; }]; // start long-running task , return immediately. dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default,0), ^{ while (_isbackground) { //// contineous run application within state. } nslog(@"background loop ended"); [app endbackgroundtask:bgtask]; bgtask = uibackgroundtaskinvalid; }); } }
1 )
apple cares battery life on iphones , ipads, strict can run in background (which say, not much).
with current shipping versions of ios, have 5 seconds clean or suspend things when application receives call "applicationdidenterbackground:
" delegate method.
you need come way upload images via background thread while app in foreground. means time can upload images while app visible user.
more information can found in closely related question.
2 )
for second issue, it's pretty clear not releasing (or setting "nil
", or resetting) variables being used in process of uploading multiple images, why see memory usage increasing , increasing , killing app.
you know instruments, sounds need more familiar tracking down memory usage , things in memory taking more , more space.
Comments
Post a Comment