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
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Kanta Oikawa
February 22, 2026
Technology
560
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
250
はじめてのCoreSpotlight
kantacky
0
190
ヘッドジェスチャを検知して Vibe Cooking - iOSDC Japan 2025
kantacky
0
720
Other Decks in Technology
See All in Technology
UniFi(ユニファイ)AIカメラの現場活用
ludicmind
1
440
WasmをRustにする
sansantech
PRO
0
250
NDIでApple Vision Proにリアルタイム映像送信
jyouryuusui
0
120
Claude Code本は、どのように執筆チームで書かれたか
oikon48
1
380
AI時代のPRレビューにどう向き合うか?
kairim0
1
240
Metadata - Section 1: HTML Basics
mohab1
0
110
V8のArray.prototype.flatを最大約20倍速くするまでと、巨大OSSへの大規模コミットの道のり
riyaamemiya
0
290
実践! SRE × AI - ABEMA における AIOps -
tetsuya28
8
3.1k
AI導入は済んだ。次は統制を作り替える番だ_AI×開発組織 Summit 2026
techtekt
PRO
0
210
Optunaの最新リリースv5.0について
pfn
PRO
0
120
USB PDを使ってスマホを労わりたい
raspython3
0
170
10年後、Engineering 行為を剥奪されるとして、わたしたちは、どう、何を創ればいいだろうか。 / If Engineering Is Taken Away in 10 Years, How and What Should We Create?
bitkey
PRO
1
190
Featured
See All Featured
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.9k
Code Reviewing Like a Champion
maltzj
529
40k
Why You Should Never Use an ORM
jnunemaker
PRO
61
10k
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
440
Impact Scores and Hybrid Strategies: The future of link building
tamaranovitovic
0
460
The Pragmatic Product Professional
lauravandoore
37
7.5k
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
New Earth Scene 8
popppiees
4
2.7k
RailsConf 2023
tenderlove
30
1.6k
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
630
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
1
3.4k
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
360
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