0

UIWebview常にバックグラウンドで実行 するように設定したいと思います。UIWebviewiPhone が ' applicationDidEnterBackground' に入ったとき、 は動作していません。UIWebviewそのため、常にバックグラウンドで実行したいと考えています。出来ますか?

4

1 に答える 1

2

すべてのアプリは、終了する前に約10分間バックグラウンドで実行し続けることができます。audio / gps / bluetoothなどの関連アプリなど、特定のアプリのみがバックグラウンドで実行を継続できます。詳細については、こちらをご覧ください

次のコードサンプルはアプリドキュメントからのものであり、開始するのに役立ちます-

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    bgTask = [application beginBackgroundTaskWithExpirationHandler:^{
        // Clean up any unfinished task business by marking where you.
        // stopped or ending the task outright.
        [application endBackgroundTask:bgTask];
        bgTask = UIBackgroundTaskInvalid;
    }];

    // Start the long-running task and return immediately.
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{

        // Do the work associated with the task, preferably in chunks.

        [application endBackgroundTask:bgTask];
        bgTask = UIBackgroundTaskInvalid;
    });
}
于 2012-10-29T00:59:00.933 に答える