一般來說,如果我打開應用並鎖定屏幕,一個小時左右後如果我解鎖屏幕,應用會重新啓動。但我的應用程序無法重新啓動或恢復。有沒有任何設置來恢復我的應用程序,或者我錯過了什麼?iOS應用在解鎖屏幕後不能恢復
if (!oprationQueue) {// Application did enter in background method
oprationQueue = [[NSOperationQueue alloc] init];
}
NSInteger updateSec = [[NH_Fetch_settings alloc] getUpdateTimeInterva];
bgdataUpdateTimer = [NSTimer scheduledTimerWithTimeInterval:updateSec target:self selector:@selector(updateData:) userInfo:nil repeats:YES];
NSInteger cleanSec = [[NH_Fetch_settings alloc] cleanupFrequency];
bgCleanupTimer = [NSTimer scheduledTimerWithTimeInterval:cleanSec target:self selector:@selector(cleapAllData:) userInfo:nil repeats:YES];
[NH_advertisement sharedInstance].isFirstTime = NO;
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"advFirst"];
backgroundTask_dataUpdate =[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
NSLog(@"%f",[UIApplication sharedApplication].backgroundTimeRemaining);
}];
backgroundTask_cleanUp =[[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
NSLog(@"%f",[UIApplication sharedApplication].backgroundTimeRemaining);
}];
}
- (void)applicationWillEnterForeground:(UIApplication *)application{
[application endBackgroundTask:backgroundTask_dataUpdate];
backgroundTask_dataUpdate = UIBackgroundTaskInvalid;
[application endBackgroundTask:backgroundTask_cleanUp];
backgroundTask_cleanUp = UIBackgroundTaskInvalid;
}
該應用程序在解鎖屏幕後不會拋出resume事件。 該加油日誌屏幕上
的UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:完成:] **未處理的動作 - > { 處理機=遠程; info = { (1)= 5; }; }
請確保您已在應用目標的「功能」選項卡中啓用了「背景模式」。 –
先生,我相信我啓用後臺模式的能力 –
你有初始化'NSOperationQueue'但沒有使用...爲什麼? –