From the course: Apple watchOS App Development: Advanced APIs
Unlock the full course today
Join today to access over 22,800 courses taught by industry experts or purchase this course individually.
userInfo in background apps
From the course: Apple watchOS App Development: Advanced APIs
userInfo in background apps
- [Instructor] Now, your count might be different than mine from the last video, since that is dependent on your system. There's that big, nasty error message about file not found. It could not be opened. This is a simulator bug, and you can usually ignore it. This bug is related to the user info property of refreshed background tasks, and gives us a good opportunity to discuss user info in a bit more detail. Go ahead and close the console, so we can get rid of all that mess. Now, to work around this error, you access user info in the background task. So, just under refresh date, I'm going to add a line for the user info. So I'm just going to add let userInfo = backgroundTask .userInfo. And I'm going to make sure I put a return here, because that's not a real line. This is actually too long a line here. You can see that by getting rid of our navigation pane. And you can see that's a real line there. Now, change the user info in the scheduled background refresh underneath from nil to…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
(Locked)
Frontmost app state4m 24s
-
(Locked)
The dock and the background states5m 15s
-
(Locked)
The extension delegate7m 25s
-
(Locked)
Challenge: A background app27s
-
(Locked)
Solution: A background app2m 38s
-
Refresh app in the background6m 57s
-
(Locked)
userInfo in background apps7m 48s
-
(Locked)
Update interface with snapshot8m 16s
-
(Locked)
Default snapshots4m 54s
-
(Locked)
-
-
-
-