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
3
640
While Your App is Sleeping
Gwendolyn Weston
September 08, 2015
Tweet
Share
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
実践AIガバナンス
asei
3
160
ZOZOTOWNフロントエンドにおけるディレクトリの分割戦略
zozotech
PRO
18
5.7k
LLMエージェント時代に適応した開発フロー
hiragram
1
430
「守る」から「進化させる」セキュリティへ ~AWS re:Inforce 2025参加報告~ / AWS re:Inforce 2025 Participation Report
yuj1osm
1
150
JavaScript 研修
recruitengineers
PRO
4
860
GitHub Copilot coding agent を推したい / AIDD Nagoya #1
tnir
4
4.8k
RAID6 を楔形文字で組んで現代人を怖がらせましょう(実装編)
mimifuwa
1
320
Product Management Conference -AI時代に進化するPdM-
kojima111
0
250
Oracle Base Database Service:サービス概要のご紹介
oracle4engineer
PRO
2
20k
Amazon Bedrock AgentCore でプロモーション用動画生成エージェントを開発する
nasuvitz
6
470
進捗
ydah
1
160
新規案件の立ち上げ専門チームから見たAI駆動開発の始め方
shuyakinjo
0
300
Featured
See All Featured
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.4k
Agile that works and the tools we love
rasmusluckow
329
21k
Intergalactic Javascript Robots from Outer Space
tanoku
272
27k
Writing Fast Ruby
sferik
628
62k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
30
9.6k
Optimising Largest Contentful Paint
csswizardry
37
3.4k
Speed Design
sergeychernyshev
32
1.1k
The Cost Of JavaScript in 2023
addyosmani
53
8.8k
The Straight Up "How To Draw Better" Workshop
denniskardys
236
140k
Bash Introduction
62gerente
614
210k
RailsConf 2023
tenderlove
30
1.2k
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