From the course: iOS Development: Security
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Request authorization for system features - iOS Tutorial
From the course: iOS Development: Security
Request authorization for system features
- [Instructor] We can request authorization to access and share health data via the HKHealthStores request authorization method. First let me stop this. And we're going to implement a private helper method called requestPermission. Private func requestPermission. The method has a completion closure argument. Most Half Kit methods are asynchronous so we need to rely on closures if we built wrappers around them. The completion closure needs to be escaping, and it takes a Boolean argument and an optional error. The Bool indicates whether the authorization is granted and callers can inspect the error parameter to find out what went wrong. Now let's finish the closure and we can start implementing the method. First I need to specify the data type we're going to access, which in our case is the step count. So I'm going to use the Guard statement and use optional binding to create the stepQuantityType which can instantiated using a call to HKObject type quantity type. ObjectType. The…
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)
Purpose strings2m 7s
-
(Locked)
Request authorization for system features4m 7s
-
(Locked)
Adding the missing purpose string1m 34s
-
Exposing sensitive data through copying and pasting2m 16s
-
(Locked)
The pasteboard spy app2m 24s
-
(Locked)
Prevent pasteboard leakage without coding1m 11s
-
(Locked)
Prevent pasteboard leakage with coding2m 11s
-
(Locked)
Using an app-specific pasteboard5m 33s
-
(Locked)
Data leakage through app screenshots2m 16s
-
(Locked)
Clearing data before moving to the background3m 7s
-
(Locked)
Obscuring the snapshot before moving to the background3m 30s
-
(Locked)
Hacking the UserDefaults4m 40s
-
(Locked)
-
-
-
-
-