Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
20190726 Background App Refresh Taskがやってきた
Search
Kei Ito
July 26, 2019
Programming
0
2.1k
20190726 Background App Refresh Taskがやってきた
Kei Ito
July 26, 2019
Tweet
Share
More Decks by Kei Ito
See All by Kei Ito
20211015 Mac CatalystでmacOS用アプリを作る
itok
2
4.2k
20210219 Flutterに入門してみた
itok
1
3.9k
20201009 iOS 14 ウィジェットをつくってみた
itok
1
2.3k
20191206 Property Wrappers 入門
itok
0
1.6k
20190920 iOS 13 対応ではまった話
itok
1
2.3k
20190722 Firebase Remote Configでアドネットワークを管理する
itok
0
1.5k
20190419 iOSアプリで証明書の情報を参照する
itok
0
1.4k
20190412 Android TV向けアプリを作ってみる
itok
0
1k
20190215 iOS/Androidでドキュメントスキャナーを作ってみた
itok
0
1.7k
Other Decks in Programming
See All in Programming
Fluent UI Blazor 5 (alpha)の紹介
tomokusaba
0
140
コンテナでLambdaをデプロイするときに知っておきたかったこと
_takahash
0
150
なぜselectはselectではないのか
taiyow
2
310
AtCoder Heuristic First-step Vol.1 講義スライド(山登り法・焼きなまし法編)
takumi152
3
980
php-fpm がリクエスト処理する仕組みを追う / Tracing-How-php-fpm-Handles-Requests
shin1x1
5
830
CRE Meetup!ユーザー信頼性を支えるエンジニアリング実践例の発表資料です
tmnb
0
360
CTFのWebにおける⾼難易度問題について
hamayanhamayan
1
980
MCP世界への招待: AIエンジニアが創る次世代エージェント連携の世界
gunta
2
580
OpenTelemetryを活用したObservability入門 / Introduction to Observability with OpenTelemetry
seike460
PRO
0
340
Django for Data Science (Boston Python Meetup, March 2025)
wsvincent
0
240
‘무차별 LGTM~👍’만 외치던 우리가 ‘고봉밥 코드 리뷰’를?
hannah0731
0
530
Go1.24で testing.B.Loopが爆誕
kuro_kurorrr
0
160
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
Mobile First: as difficult as doing things right
swwweet
223
9.5k
Why Our Code Smells
bkeepers
PRO
336
57k
Optimizing for Happiness
mojombo
377
70k
Into the Great Unknown - MozCon
thekraken
36
1.7k
It's Worth the Effort
3n
184
28k
The Invisible Side of Design
smashingmag
299
50k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
17
1.1k
Why You Should Never Use an ORM
jnunemaker
PRO
55
9.3k
Faster Mobile Websites
deanohume
306
31k
Side Projects
sachag
452
42k
The Pragmatic Product Professional
lauravandoore
33
6.5k
Transcript
#BDLHSPVOE"QQ 3FGSFTI5BTL͕ ͖ͬͯͨ .PCJMF"DU04"," JUPL!ͦΒ͔ͥ
JUPL!ͦΒ͔ͥ w ͍ͱ͏͚͍ʢJUPLʣ w ɹɹɹɹɹɹͷதͷਓʢʴ෭ۀˏͯͳʣ w ϞόΠϧΞϓϦΤϯδχΞ݉$&0 w IUUQTJUPLKQ IUUQTTPSBLB[FDPKQ
!JUPLKQ
ॴࡏɿژࢢதژ۠ ࣾһਓࣗ
J04"OESPJENBD048JOEPXTαʔό ҰਓͰͬͯ·͢ʢσβΠϯҎ֎ʣ
#BDLHSPVOE"QQ 3FGSFTI5BTL͕ ͖ͬͯͨ
"EWBODFTJO"QQ #BDLHSPVOE&YFDVUJPO EFWFMPQFSBQQMFDPNWJEFPTQMBZXXED 88%$4FTTJPO
J04
#BDLHSPVOE5BTLT GSBNFXPSL
None
#BDLHSPVOE"QQ 3FGSFTI5BTL w ඵؒಈ͚Δ w ΞϓϦΛ࠷৽ͷঢ়ଶʹอͯΔ w CBDLHSPVOEGFUDIͷ"1*EFQSFDBUFE w NBD04چ"1*Ͱಈ͔ͳ͍͔ΒJ1BE04
$BUBMZTU͏ͳΒ͜ΕʹҠߦ͢͠
#BDLHSPVOE1SPDFTTJOH 5BTL w ಈ͚Δ w %#ͷϝϯςφϯεͱ͔ɺ.-ͷֶशͱ͔
४උ w DBQBCJMJUZˠCBDLHSPVOENPEFTˠ w CBDLHSPVOEGFUDI w CBDLHSPVOEQSPDFTTJOH w *OGPQMJTUˠ#(5BTL4DIFEVMFS1FSNJUUFE*EFOUJpFST w
λεΫͷࣝผࢠΛྻڍ
λεΫͷొ BGTaskScheduler.shared.register(forTaskWithIdentifier: "XXX", using: nil) { task in self.handleAppRefresh(task: task
as! BGAppRefreshTask) }
λεΫͷೖ func applicationDidEnterBackground(_ application: UIApplication) { scheduleAppRefresh() } func scheduleAppRefresh()
{ let request = BGAppRefreshTaskRequest(identifier: "XXX") request.earliestBeginDate = Date(timeIntervalSinceNow: 15 * 60) do { try BGTaskScheduler.shared.submit(request) } catch { print("Could not schedule app refresh: \(error)") } }
λεΫͷ࣮ߦ func handleAppRefresh(task: BGAppRefreshTask) { // ඞཁ͕͋Ε࠶ೖ scheduleAppRefresh() task.expirationHandler =
{ // ࣮ߦظݶ͕Εͨͱ͖ͷΩϟϯηϧॲཧ } // do something // λεΫྃ task.setTaskCompleted(success: true) }
ύϥϝʔλ w ڞ௨ w FBSMJFTU#FHJO%BUF w ԕ͗͢ΔະདྷͩΊ w िؒҎ͘Β͍͕·͍͠ w
ʮ࠷ʯͳͷͰ࣮ߦ͞ΕΔͱݶΒͳ͍
ύϥϝʔλ w QSPDFTTJOHUBTL w SFRVJSFT/FUXPSL$POOFDUJWJUZ w SFRVJSFT&YUFSOBM1PXFS w $16Λ͏ࣄΛ͢Δ߹USVFʹ͓ͯ͜͠͏
σόοά w σόοΨ͔ΒλεΫͷ࣮ߦظݶΕΛςετՄೳ IUUQTEFWFMPQFSBQQMFDPNEPDVNFOUBUJPOCBDLHSPVOEUBTLT TUBSUJOH@BOE@UFSNJOBUJOH@UBTLT@EVSJOH@EFWFMPQNFOU FMPCKD WPJE <<#(5BTL4DIFEVMFSTIBSFE4DIFEVMFS>a @TJNVMBUF-BVODI'PS5BTL8JUI*EFOUJpFS!999>
#BDLHSPVOEΛͯ͠ ΑΓΑ͍ϢʔβମݧΛʂ