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
2k
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
3.8k
20210219 Flutterに入門してみた
itok
1
3.6k
20201009 iOS 14 ウィジェットをつくってみた
itok
1
2.3k
20191206 Property Wrappers 入門
itok
0
1.5k
20190920 iOS 13 対応ではまった話
itok
1
2.2k
20190722 Firebase Remote Configでアドネットワークを管理する
itok
0
1.4k
20190419 iOSアプリで証明書の情報を参照する
itok
0
1.3k
20190412 Android TV向けアプリを作ってみる
itok
0
990
20190215 iOS/Androidでドキュメントスキャナーを作ってみた
itok
0
1.6k
Other Decks in Programming
See All in Programming
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
120
CSC509 Lecture 12
javiergs
PRO
0
160
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
300
AI時代におけるSRE、 あるいはエンジニアの生存戦略
pyama86
6
1.2k
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
0
100
Compose 1.7のTextFieldはPOBox Plusで日本語変換できない
tomoya0x00
0
190
Contemporary Test Cases
maaretp
0
140
OnlineTestConf: Test Automation Friend or Foe
maaretp
0
110
どうして僕の作ったクラスが手続き型と言われなきゃいけないんですか
akikogoto
1
120
Outline View in SwiftUI
1024jp
1
330
初めてDefinitelyTypedにPRを出した話
syumai
0
420
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
459
33k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Optimising Largest Contentful Paint
csswizardry
33
2.9k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
Making the Leap to Tech Lead
cromwellryan
133
8.9k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.8k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
26
2.1k
Building Better People: How to give real-time feedback that sticks.
wjessup
364
19k
It's Worth the Effort
3n
183
27k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Why You Should Never Use an ORM
jnunemaker
PRO
54
9.1k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
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Λͯ͠ ΑΓΑ͍ϢʔβମݧΛʂ