Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
もう怖くないバックグラウンド処理 Background Tasks のすべて - Hakoda...
Search
Kanta Oikawa
February 22, 2026
Technology
520
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
もう怖くないバックグラウンド処理 Background Tasks のすべて - Hakodate.swift #1
Hakodate.swift #1 LT
Kanta Oikawa
February 22, 2026
More Decks by Kanta Oikawa
See All by Kanta Oikawa
2027年のMetricKit
kantacky
0
240
はじめてのCoreSpotlight
kantacky
0
170
ヘッドジェスチャを検知して Vibe Cooking - iOSDC Japan 2025
kantacky
0
710
Other Decks in Technology
See All in Technology
雪かき部 #7 もう怖くない!SELECT文!
foursue
0
120
C#未経験の僕がAIに読めるコードを書かせるまで
maguroalternative
0
330
2026-09-08 そのJavaモダナイゼーション、AIに丸投げで大丈夫?IBM Bobで変わる品質と効率
yutanonaka
1
210
DORA_Metrics.pdf
wagnerfusca
1
110
なぜ「決定性」が 決定的に重要なのか? Durable Execution 基盤の数理的理解 #serverlessjp / ServerlessDays Tokyo 2026
ytaka23
4
1.3k
Coil3を内部実装から読み解く~キャッシュ戦略とAVIF画像の描画〜/nikkei-tech-talk50
nikkei_engineer_recruiting
0
120
AIは推し活である。
kurazuuuuuu
2
990
企業の現実世界をグラフで写し取る
sansantech
PRO
0
160
Datadog で始める トークンセーフティなAI 導⼊と定着
vkbaba
1
110
Antigravity SDK for the Java Developer
glaforge
0
220
GitHub Agentic Workflows を触ってみる
htkym
2
810
Account Factory for Terraformによる 標準化されたアカウント発行の自動化
pensuke628
0
110
Featured
See All Featured
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
17k
SEO for Brand Visibility & Recognition
aleyda
0
4.8k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
254
22k
brightonSEO & MeasureFest 2025 - Christian Goodrich - Winning strategies for Black Friday CRO & PPC
cargoodrich
3
850
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
68
58k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
1
500
Technical Leadership for Architectural Decision Making
baasie
3
580
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
250
How Software Deployment tools have changed in the past 20 years
geshan
2
34k
Mind Mapping
helmedeiros
1
370
How to Get Subject Matter Experts Bought In and Actively Contributing to SEO & PR Initiatives.
livdayseo
0
200
How to Grow Your eCommerce with AI & Automation
katarinadahlin
PRO
2
290
Transcript
Kanta Oikawa - 2026/02/22 ͏ා͘ͳ͍όοΫάϥϯυॲཧ Background Tasks ͷͯ͢ Hakodate.swift #1
LT
όοΫάϥϯυॲཧා͍ɺ͚Ͳେࣄ • iOSͷόοΫάϥϯυॲཧ੍͕ଟͯ͘େมͦ͏ • σόοά͕େมͦ͏ • ͰɺϢʔβʔମݧΛ্ͤ͞ΔͨΊʹආ͚ΒΕͳ͍͜ͱ • ۩ମతͳ੍ =
όοΫάϥϯυॲཧΛ࣮ߦ͢Δํ๏ • σόοάͷํ๏ • ͞Βͬͱ5Ͱ… 2
3
4
5
6
όοΫάϥϯυॲཧͷछྨͱํ๏ • Background ͰॲཧΛ։࢝͢Δ • App Refresh (BGAppRefreshTask) • Background
Push Noti fi cation • Processing (BGProcessingTask) • Foreground Ͱ։࢝ͨ͠ॲཧΛ Background Ͱܧଓ͢Δ • UIApplication / beginBackgroundTask(expirationHandler:) • BGContinuedProcessingTask (26+) 7
Background ͰॲཧΛ։࢝͢Δ App Refresh (BGAppRefreshTask) • e.g. גՁΞϓϦͰ࠷৽ͷגՁΛऔಘ • සൟʹΞΫηε͢ΔσʔλΛ࠷৽ͷঢ়ଶʹอͭ
• ࣮ߦλΠϛϯάΞϓϦͷ༻ύλʔϯʹԠͯ͡γεςϜ͕ܾఆ • "࣍ճ࣮ߦ·Ͱͷ࠷খ࣌ؒ" ͷΈίϯτϩʔϧՄೳ 8
Background ͰॲཧΛ։࢝͢Δ Background Push Noti fi cation • e.g. χϡʔεΞϓϦͷใهࣄ
• ཁ͢Δʹ Remote Push Noti fi cation • Push ϕʔεͰσʔλΛߋ৽ App Refresh Fetch ϕʔεͰσʔλΛߋ৽ • Push Noti fi cation Λड͚औͬͨޙͷॲཧ͕ଈ࣮࣌ߦ͞ΕΔอূͳ͍ 9
Background ͰॲཧΛ։࢝͢Δ Processing (BGProcessingTask) • e.g. σʔλϕʔεͷཧ • Ϣʔβʔ͕σόΠεΛ༻͍ͯ͠ͳ͍ؒʹ࣮ߦ͞ΕΔ •
Ϣʔβʔ͕σόΠεͷ༻Λ࢝ΊΔͱఀࢭ͞ΕΔ • ͔͔Δॲཧ࣮ߦͰ͖Δ͕ɺγεςϜʹΑΓதஅ͞ΕΔՄೳੑ͕͋Δ • ωοτϫʔΫଓঢ়ଶɺిݯଓঢ়ଶΛ࣮ߦ݅ͱͯ͠ࢦఆͰ͖Δ 10
Foreground Ͱ։࢝ͨ͠ॲཧΛ Background Ͱܧଓ͢Δ UIApplication / beginBackgroundTask(expirationHandler:) • e.g. ঢ়ଶͷมߋ,
σʔλϕʔεͷஅ • γεςϜ͕։࢝ͨ͠ॲཧΛɺ BackgroundʹભҠͯ͠ܧଓͯྃͤ͠͞Δ 11
Foreground Ͱ։࢝ͨ͠ॲཧΛ Background Ͱܧଓ͢Δ BGContinuedProcessingTask (26+) • e.g. InstagramͷετʔϦʔΛߘ •
Ϣʔβʔ͕։࢝ͨ͠ॲཧΛBackgroundʹભҠͯ͠ܧଓͯྃͤ͠͞Δ • ਐḿ͕Live ActivityͰදࣔ͞ΕΔ 12
Background Tasks ͷϑϩʔνϟʔτ 13
όοΫάϥϯυॲཧΛ࣮ߦ Background Modes Λ༗ޮԽ 14
όοΫάϥϯυॲཧΛ࣮ߦ Task ID Λ Info.plist ʹొ 15
όοΫάϥϯυॲཧΛ࣮ߦ (App Refresh, Processing) Task ID Λࢦఆͯ͠λεΫΛεέδϡʔϧ private func scheduleAppRefresh()
{ let request = BGAppRefreshTaskRequest(identifier: appRefreshTaskIdentifier) request.earliestBeginDate = Date(timeIntervalSinceNow: 15 * 60) do { try BGTaskScheduler.shared.submit(request) print("Scheduled app refresh successfully") } catch { print("Failed to schedule app refresh: \(error)") } } 16
App Refresh ͱ Processing Λσόοά 1. Xcode Ͱ Run Destination
ʹ࣮ػΛબ 2. Run ͯ͠λεΫΛεέδϡʔϧ 3. Foreground Ͱ Pause program execution ϘλϯΛԡ͢ 4. Home Screen ʹΔͳͲͯ͠ Background ʹભҠͤ͞Δ 5. LLDBͰҎԼΛ࣮ߦʢൃՐ͍ͤͨ͞λεΫͷTask IDΛࢦఆ͢Δʣ e -l objc -- (void)[[BGTaskScheduler sharedScheduler] _simulateLaunchForTaskWithIdenti fi er:@"com.kantacky.BackgroundTasksSample .refresh"] 17
࣮ࡍʹͬͯΈͨ ࣮ • 2/20·Ͱͷ1िؒ͘Β͍Ͱ Vibe Coding ͯ͠৹ࠪʹఏग़ͨ͠ΞϓϦ • RSS ϑΟʔυϦʔμʔ
• App RefreshͰϑΟʔυΛFetchͯ͠৽ணهࣄΛϩʔΧϧ௨ 18
࣮ࡍʹͬͯΈͨ ͱղܾࡦ • ӡΑ۪͘ʹ࣮ߦ͞Εͯɺ࣍ճ࣮ߦ·Ͱͷ࠷খ࣌ؒ͝ͱʹ௨͕དྷͯ͏͍͟ • ࣍ճ࣮ߦ·Ͱͷ࠷খ࣌ؒΛେ͖͘͢Δɺ௨ରΛߜΔ • Background Push Noti
fi cation Λ͏ • αʔόʔͰϑΟʔυΛFetchͯ͠ɺ৽ணهࣄΛϦϞʔτ௨ • ௨ΛఘΊͯɺApp RefreshͰϑΟʔυΛ࠷৽ͷঢ়ଶʹอ͚ͭͩʹͱͲΊΔ 19
Materials https://kantacky.com/hakodate-swift-1 • εϥΠυ • https://speakerdeck.com/kantacky/hakodate-swift-1 • App RefreshΛ࣮ͨ͠αϯϓϧίʔυ •
https://github.com/kantacky/background-tasks-ios 20
Kanta Oikawa • ެཱͩͯ͜ະདྷେֶ M1 • Έͳ͞ΜɺവؗʹΑ͏ͦ͜ʂ • ͥͻຬ٤͍͍ͯͬͯͩ͘͠͞ 21