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 결과는 다음회에…

댓글 남기기

당신의 이메일은 공개되지 않습니다. 필수 입력창은 * 로 표시되어 있습니다.

*

다음의 HTML 태그와 속성을 사용할 수 있습니다: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>