Skip to content

Instantly share code, notes, and snippets.

@naotokui
Created November 20, 2012 23:32
Show Gist options
  • Save naotokui/4122008 to your computer and use it in GitHub Desktop.
Save naotokui/4122008 to your computer and use it in GitHub Desktop.

Revisions

  1. naotokui renamed this gist Nov 20, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. naotokui renamed this gist Nov 20, 2012. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions gistfile1.m → gistfile1.matlab
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,6 @@
    // バックグラウンド処理のスタートを宣言
    UIBackgroundTaskIdentifier bgTask = UIBackgroundTaskInvalid;
    bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:
    ^{
    bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:^{
    [[UIApplication sharedApplication] endBackgroundTask:bgTask];
    }];

  3. naotokui created this gist Nov 20, 2012.
    14 changes: 14 additions & 0 deletions gistfile1.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    // バックグラウンド処理のスタートを宣言
    UIBackgroundTaskIdentifier bgTask = UIBackgroundTaskInvalid;
    bgTask = [[UIApplication sharedApplication] beginBackgroundTaskWithExpirationHandler:
    ^{
    [[UIApplication sharedApplication] endBackgroundTask:bgTask];
    }];

    /* ここでやりたい処理をする */

    // バックグラウンド処理の終了
    if (bgTask != UIBackgroundTaskInvalid){
    [[UIApplication sharedApplication] endBackgroundTask:bgTask];
    bgTask = UIBackgroundTaskInvalid;
    }