通常、どのアプリでもアプリを開いて画面をロックすると、画面をロック解除してからアプリが再起動されます。しかし、私のアプリは再起動や再開に失敗します。私のアプリを再開するための設定はありますか、何か不足していますか?画面のロック解除後に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;
}
アプリは、画面のロックを解除した後に再開イベントをスローしません。 forScene:withTransitionContext:終了: このログ画面上
のUIApplication _handleNonLaunchSpecificActions来] **未処理アクション - > { ハンドラ=リモコン; info = { (1)= 5; };あなたはあなたが必要な方法でコードを実行しAppDelgate
- (void)applicationWillResignActive:(UIApplication *)application;
- (void)applicationDidEnterBackground:(UIApplication *)application;
- (void)applicationWillEnterForeground:(UIApplication *)application;
- (void)applicationDidBecomeActive:(UIApplication *)application;
の次の方法によりを求める何ができる }
あなたのアプリターゲットの 'Capabilities'タブで' Background Modes'を有効にしてください。 –
サー、私は能力のバックグラウンドモードを有効にしたと確信しています –
あなたは 'NSOperationQueue'を初期化しましたが、使用しませんでした...なぜですか? –