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
While Your App is Sleeping
Search
Gwendolyn Weston
September 08, 2015
Technology
660
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
While Your App is Sleeping
Gwendolyn Weston
September 08, 2015
More Decks by Gwendolyn Weston
See All by Gwendolyn Weston
Keep Calm and Type Erase On
gwengrid
3
25k
Other Decks in Technology
See All in Technology
はじめてのDatabricks:技術者向けワークショップ / beginner-workshop
databricksjapan
PRO
0
160
AI-DLCって実際どう? 〜聞きたいこと全部聞いてみる〜
news_it_enj
0
220
プロダクト思考 × 基盤思考を AIで実現する Compound Engineering
tkc66buzz
1
260
データエンジニアリングワークショップ:Auto LoaderとSparkで学ぶデータパイプライン構築
databricksjapan
PRO
0
160
JAWS-UG初心者支部#88わいわい初心塾(夏休みの宿題やったかGit編)
otsuki
0
130
Bet AI Day 2026丨AIによって本質に戻るシステムリスク管理
layerx
PRO
0
910
AIエージェントを雇う前に決める5つのこと
knishioka
1
160
From Vanilla Kubernetes to a Batteries-Included Platform: Developer Experience at 1,300+ Clusters
yosshi_
0
480
作り直せるコードは迅速に 作り直せないDBは慎重に - AI時代のプロダクトエンジニアが「判断の不可逆性」で開発速度を変える話
kinosuke01
0
240
[RSJ26] NarrativeFlow: Flow-Based Vision-Language-Action Model Using Robot Velocity Fields
keio_smilab
PRO
0
160
Azure Cost Management の FOCUS コストデータを迷わず読むための“3つの軸”
tetsuyaooooo
0
140
Where Is JetBrains AI Heading- — Central CLI, Air Alpha, and the Agentic Development Stack
x5gtrn
PRO
0
130
Featured
See All Featured
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
A brief & incomplete history of UX Design for the World Wide Web: 1989–2019
jct
2
500
Speed Design
sergeychernyshev
33
2.1k
Are puppies a ranking factor?
jonoalderson
2
3.9k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
30k
Building an army of robots
kneath
306
46k
Building Flexible Design Systems
yeseniaperezcruz
330
41k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.6k
Agile Leadership in an Agile Organization
kimpetersen
PRO
0
220
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.7k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
Documentation Writing (for coders)
carmenintech
77
5.5k
Transcript
While Your App Was Sleeping Gwendolyn Weston @purpleyay
Background Transfer Services allows uploading or downloading requests to continue
on after app is terminated
Motivation
A Teakettle • That requires you to stand near it
• As well as continue to watch in order for it to boil water
Where can this happen in our apps?
PlanGrid
To guarantee download completion • Users would have to change
their settings so that the device never locks • Stay on the app
Downloading without Background Transfer Services is like watching water boil.
Overview • How to download in the foreground • How
to make that request background compatible • How to navigate common pitfalls
Downloading in the foreground
Downloading in Foreground
Downloading in Foreground NSURLSession: vends and manages requests
Downloading in Foreground sharedSession: singleton session with default settings
Downloading in Foreground NSURLSessionDownloadTask: the request
NSURLSessionTask • NSURLSessionDownloadTask • NSURLSessionUploadTask • NSURLSessionDataTask - short-lived requests
(not background compatible!)
We get tasks by feeding our session URLs
Cookie Monster as NSURLSession
None
Downloading in Foreground
Downloading in Foreground
Downloading in Foreground
Downloading in Foreground
Downloading in the background
Downloading in Foreground
None
NSURLSessionConfiguration: defines request behaviour and policies
None
Identifiers must be unique!
“I’m done downloading!!! Wake up!” application: handleEventsForBackgroundURLSession: completionHandler “It’s me,
the session called waterBoiling Session!”
None
!!Must!! re-instantiate session with identifier or delegate methods for request
will not get called.
“The behavior of multiple sessions sharing the same identifier is
undefined.”
Downloading in Background
None
Downloading in Background
“Completion handler blocks are not supported in background sessions”
Pitfall no completion handlers
Downloading in Background
“I’m done downloading!!! Wake up!” URLSession:downloadTask:didFinishDownloadingTo URL: “It’s me, the
request for task 42 in the session called boilingWaterSession!”
The delegate!
Downloading in Background
None
Downloading in Background
Pitfall No auxiliary request info
Promising… ?
Nope.
Subclasses?
None
Downloading in Background
“Can I have—“ “No.” “Just one subclass—“ “No.” NSURLSession
Persistence!
Downloading in Background
YUSS.
Questions? @purpleyay