-
Notifications
You must be signed in to change notification settings - Fork 0
/
watchoslifecyclecallbacks.html
247 lines (229 loc) · 5.71 KB
/
watchoslifecyclecallbacks.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>watchOS Life Cycle Call Backs</title>
</head>
<body>
<h1>watchOS Life Cycle Call Backs</h1>
<p>What call backs are made to <tt>ExtensionDelegate</tt> and <tt>InterfaceController</tt> during different life cycle changes.</p>
<p>This was done with an Apple Watch Series 3.</p>
<h2>Launch</h2>
<ol>
<li><em>Precondition:</em> app is not running.
<li>User taps app icon on Watch face.
<li>App becomes active.
</ol>
<samp>
<pre>
ExtensionDelegate.applicationDidFinishLaunching
ExtensionDelegate.applicationWillEnterForeground
InterfaceController.awake context = nil
ExtensionDelegate.applicationDidBecomeActive
InterfaceController.willActivate
InterfaceController.didAppear
</pre>
</samp>
<h2>Wrist drop</h2>
<ol>
<li><em>Precondition:</em> app is active.
<li>User drops wrist.
<li>App is frontmost app.
<li>Watch face goes dark.
</ol>
<samp>
<pre>
ExtensionDelegate.applicationWillResignActive
InterfaceController.didDeactivate
</pre>
</samp>
<h2>Wrist up</h2>
<ol>
<li><em>Precondition:</em> app is frontmost app.
<li><em>Precondition:</em> user's wrist is down.
<li>User raises wrist.
<li>App is active.
</ol>
<samp>
<pre>
ExtensionDelegate.applicationDidBecomeActive
InterfaceController.willActivate
</pre>
</samp>
<h2>Active to Dock</h2>
<ol>
<li><em>Precondition:</em> app is active.
<li>User clicks side button.
<li>Watch shows Dock.
<li>App is index 0 of Dock.
</ol>
<samp>
<pre>
ExtensionDelegate.applicationWillResignActive
InterfaceController.didDeactivate
ExtensionDelegate.applicationDidEnterBackground
</pre>
</samp>
<h2>Face to Dock, index 1</h2>
<ol>
<li><em>Precondition:</em> app is index 1 of Dock.
<li><em>Precondition:</em> Watch showing face.
<li>User clicks side button.
<li>Watch shows Dock.
<li>App is index 1 of Dock.
</ol>
<samp>
<pre>
ExtensionDelegate.applicationWillEnterForeground
InterfaceController.willActivate
</pre>
</samp>
<h2>Face to Dock, index 0</h2>
<ol>
<li><em>Precondition:</em> app is index 0 of Dock.
<li><em>Precondition:</em> Watch showing face.
<li>User clicks side button.
<li>Watch shows Dock.
<li>App is index 0 of Dock.
</ol>
<samp>
<pre>
[No callbacks invoked.]
</pre>
</samp>
<h2>Face to Dock, last index (2 Step)</h2>
<h3>1. Face to Dock</h3>
<ol>
<li><em>Precondition:</em> app is in Dock at last index
<li>Watch showing face.
<li>User clicks side button.
<li>Watch shows Dock.
</ol>
<samp>
<pre>
[No callbacks invoked.]
</pre>
</samp>
<h3>2. Scroll to last index in Dock</h3>
<ol>
<li><em>Precondition:</em> step 1 is followed.
<li>User scrolls to last index of Dock.
<li>App shows in Dock.
</ol>
<samp>
<pre>
ExtensionDelegate.applicationWillEnterForeground
InterfaceController.willActivate
</pre>
</samp>
<h2>Face to Dock, not in Dock</h2>
<ol>
<li><em>Precondition:</em> app was active recently.
<li><em>Precondition:</em> app is not in Dock
<li><em>Precondition:</em> app was not manually removed from Dock.
<li>Watch showing face.
<li>User clicks side button.
<li>Watch shows Dock.
<li>User scrolls up and down entire Dock.
</ol>
<samp>
<pre>
[No callbacks are invoked.]
</pre>
</samp>
<h2>Idle then Active Face (3 steps)</h2>
<h3>1. Go dark</h3>
<ol>
<li><em>Precondition:</em> app is active.
<li>User does nothing for a several seconds.
<li>Watch face goes dark.
<li>User does not move their wrist.
</ol>
<samp>
<pre>
ExtensionDelegate.applicationWillResignActive
InterfaceController.didDeactivate
</pre>
</samp>
<h3>2. Wait</h3>
<ol>
<li><em>Precondition:</em> step 1 followed.
<li>User does not move wrist
<li>User waits a few minutes
</ol>
<samp>
<pre>
ExtensionDelegate.applicationDidEnterBackground
</pre>
</samp>
<h3>3. Move again</h3>
<ol>
<li><em>Precondition:</em> step 2 followed.
<li>User taps dark Watch face.
<li>Watch shows face.
<li>Watch does <strong>not</strong> show app.
<li>User keeps Watch face active by occassional taps for a couple more minutes.
<li>App is never active.
<li>This this happens:
</ol>
<samp>
<pre>
InterfaceController.willActivate
InterfaceController.didAppear
ExtensionDelegate.handle backgroundTasks = [<WKSnapshotRefreshBackgroundTask: 0x176ae740> reason=4]
ExtensionDelegate.handle backgroundTasks is WKSnapshotRefreshBackgroundTask
InterfaceController.didDeactivate
InterfaceController.willDisappear
</pre>
</samp>
<h2>To Dock then Remove (2 step)</h2>
<h3>1. Active to Dock scroll</h3>
<ol>
<li><em>Precondition:</em> app is active.
<li>User presses side button.
<li>Watch shows Dock.
<li>App is at index 0 in Dock.
<li>User scrolls to top of Dock.
</ol>
<samp>
<pre>
ExtensionDelegate.applicationWillResignActive
InterfaceController.didDeactivate
ExtensionDelegate.applicationDidEnterBackground
ExtensionDelegate.applicationWillEnterForeground
InterfaceController.willActivate
</pre>
</samp>
<h3>2. Remove from Dock</h3>
<ol>
<li><em>Precondition:</em> step 1 followed.
<li>User swipes to from off-face right to left.
<li>Watch shows red 'X' next to app in Dock.
<li>User taps red 'X'.
</ol>
<samp>
<pre>
[No other callbacks invoked.]
[InterfaceController.deinit **not** called.]
[App is terminated.]
</pre>
</samp>
<h2>Not running</h2>
<ol>
<li><em>Precondition:</em> app is not active.
<li>User occasionally uses the Watch.
<li>A few minutes pass.
<li>User does <strong>not</strong> active the app during this time.
</ol>
<samp>
<pre>
InterfaceController.willActivate
InterfaceController.didAppear
ExtensionDelegate.handle backgroundTasks = [<WKSnapshotRefreshBackgroundTask: 0x16e79bc0> reason=4]
ExtensionDelegate.handle backgroundTasks is WKSnapshotRefreshBackgroundTask
InterfaceController.didDeactivate
InterfaceController.willDisappear
</pre>
</samp>
</body>
</html>