From the course: iOS Development: Security

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

Purpose strings

Purpose strings

- [Instructor] All right, let's get started by requesting authorization to access some protected resources. We do that by adding special keys called purpose strings to the app's info property list. For each key, there needs to be a comment that explains why the app needs to access the data and how it intends to use it. For example, if we need to access the iPhone's camera, we'd add an entry like the following. Here you can see the comprehensive list of purpose strings and the various APIs to creating the authorization status for accessing the given resources. All right, let's switch to Xcode and build authorization check into our app. I've gone ahead and created a basic app called HealthApp. It's a single-view app that should show the step count for the current day. If you want to follow along with me, you can find the project in the exercise files folder. Chapter two, two one, begin. The interesting part is in the View Controller. HealthKit may not be available on the user's device…

Contents