iphone后台功能执行

   
- ( void )applicationDidEnterBackground:(UIApplication * )application {



__block UIBackgroundTaskIdentifier bgTask;



bgTask
= [application beginBackgroundTaskWithExpirationHandler: ^ {



dispatch_async(dispatch_get_main_queue(),
^ {



if (bgTask != UIBackgroundTaskInvalid)



{

bgTask
= UIBackgroundTaskInvalid;

}

});

}];



dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT,
0 ), ^ {



dispatch_async(dispatch_get_main_queue(),
^ {

NSLog(
@" 555555 " );



});



});

}

你可能感兴趣的:(iPhone)