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");



});



});

}

原文地址:https://www.cnblogs.com/qq78292959/p/2076925.html