Friday, 23 July 2010

Resolved Multitasking Background Tasks


in app asynchronous downloads, trying implement multitasking allow background tasks complete, getting errors. in appdelegate didenterbackground:
code:
  application = [uiapplication sharedapplication]; //get shared application instance            __block uibackgroundtaskidentifier background_task; //create task object            background_task = [application beginbackgroundtaskwithexpirationhandler: ^ {          [application endbackgroundtask: background_task]; //tell system done tasks          background_task = uibackgroundtaskinvalid; //set task invalid                    //system shutting down app @ point in time      }];            //background tasks require use asyncrous tasks            dispatch_async(dispatch_get_global_queue(dispatch_queue_priority_default, 0), ^{          //perform tasks application requires                    nslog(@"\n\nrunning in background!\n\n");                    [application endbackgroundtask: background_task]; //end task system knows done need perform          background_task = uibackgroundtaskinvalid; //invalidate background_task      });  
i start download, , click home button. download doesn't terminate, doesn't keep going. once go app resumes. then, when app finished: if sent background @ point during download, following error in console:
code:
    2012-03-13 12:17:25.981 smcoc[16086:17f03] *** terminating app due uncaught exception 'nsunknownkeyexception', reason: '[<__nscfstring 0x10ce80f0> valueforundefinedkey:]: class not key value coding-compliant key response.'  *** first throw call stack:  
if allow download finish without ever entering background, fine.
 

the code posted looks should throw nslog , finish background task. there other code removed?

error seems unrelated background tasks. @ point seems code getting run this.

code:
  [someobject valueforkey:@"response"];  
and someobject variable nsstring. maybe trying reference invalid pointer happens point string?
 


Forums iPhone, iPad, and iPod Touch iOS Programming


  • iPhone
  • Mac OS & System Software
  • iPad
  • Apple Watch
  • Notebooks
  • iTunes
  • Apple ID
  • iCloud
  • Desktop Computers
  • Apple Music
  • Professional Applications
  • iPod
  • iWork
  • Apple TV
  • iLife
  • Wireless

No comments:

Post a Comment