当应用程序进入iphone的背景时,如何在中对任务进行计数
即使应用程序在iPhone iOS中退出活动状态时进入后台,我如何运行任务直到任务完成。首先,我们需要检查设备是否支持多任务处理当应用程序进入iphone的背景时,如何在中对任务进行计数,iphone,objective-c,ios5,ios4,ios6,Iphone,Objective C,Ios5,Ios4,Ios6,即使应用程序在iPhone iOS中退出活动状态时进入后台,我如何运行任务直到任务完成。首先,我们需要检查设备是否支持多任务处理 if([UIDevice currentDevice]respondsToSelector:@selector(isMultitaskingSupported)){ // If the device supports Multitasking we can run the task as :- UIBackgroundTaskIdentifier b
if([UIDevice currentDevice]respondsToSelector:@selector(isMultitaskingSupported)){
// If the device supports Multitasking we can run the task as :-
UIBackgroundTaskIdentifier bgTask;
bgTask=[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
[[UIApplication sharedApplication] endBackgroundTask:bgTask];
}];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul), ^{
for(double i=0; i<99999; i++)
NSLog(@"Backgroudn quee");
[[UIApplication sharedApplication] endBackgroundTask:bgTask];
});
}
首先,我们需要检查设备是否支持多任务处理
if([UIDevice currentDevice]respondsToSelector:@selector(isMultitaskingSupported)){
// If the device supports Multitasking we can run the task as :-
UIBackgroundTaskIdentifier bgTask;
bgTask=[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
[[UIApplication sharedApplication] endBackgroundTask:bgTask];
}];
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0ul), ^{
for(double i=0; i<99999; i++)
NSLog(@"Backgroudn quee");
[[UIApplication sharedApplication] endBackgroundTask:bgTask];
});
}
这是答案还是你在补充问题?谢谢我找到的答案,这是答案还是你在补充问题?谢谢我找到的答案