iOS Background Long Running Task

(void)applicationDidEnterBackground:(UIApplication *)application
{
UIApplication* ? ?app = [UIApplication sharedApplication];

longRunTask =??beginBackgroundTaskWithExpirationHandler:^{

// If you’re worried about exceeding 10 minutes, handle it here

[app endBackgroundTask:bgTask];
longRunTask = UIBackgroundTaskInvalid;

}];

count=0;

theTimer=[NSTimer scheduledTimerWithTimeInterval:60.0f

target:self?selector:@selector(increment)

userInfo:nil?repeats:YES];

}

//- (void)increment {

if (count==1000) {

[theTimer invalidate];

[theTimer release];

[[UIApplication sharedApplication] endBackgroundTask:longRunTask];

longRunTask = UIBackgroundTaskInvalid;

} else {

[self callServerPage:@"parameters"];

count++;

}

}

Test 결과는 다음회에…