내용으로 건너뛰기

__CAPGO_KEEP_5__

iOS 백그라운드 처리 사용 BGTaskScheduler. 앱은 물리적 장치에서 스케줄링이 작동하기 전에 배경 모드와 허용된 작업 식별자를 선언해야 합니다.

Info.plist

Info.plist

이 키를 추가하세요. ios/App/App/Info.plist:

<key>UIBackgroundModes</key>
<array>
<string>processing</string>
</array>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>app.capgo.backgroundtask.processing</string>
</array>

Sync

Sync
터미널 창
npx cap sync ios

Behavior

Behavior
  • minimumInterval is mapped to earliestBeginDate.
  • iOS는 실제 실행 시간을 배터리, 네트워크, 사용 패턴 및 시스템 정책에 따라 결정합니다.
  • Background task execution은 시뮬레이터에서 신뢰할 수 없으므로 실제 장치에서 테스트하세요.
  • 플러그인은 각 작업 시작 후 다음 배경 처리 요청을 재 스케줄링합니다.

만료

만료

사용 addExpirationListener iOS가 작업을 일찍 종료할 때 작업이 정리되어야 하는 경우 사용하세요.

const handle = await BackgroundTask.addExpirationListener((event) => {
console.warn('Task expired', event.taskName);
});
await handle.remove();