What’s New With Privacy?

Learn about the new privacy features introduced in iOS 14.5, including accessing the new privacy-focused image picker, handling location permissions and more. By Renan Benatti Dias.

Leave a rating/review
Download materials
Save for later
Share
You are currently viewing page 3 of 4 of this article. Click here to view the first page.

Adding When in Use Description to Info.plist

Open Info.plist and add the following key:

  • Privacy – Location When In Use Usage Description with a value of YourPrivacy uses your current location to add this data to your pictures.

This key allows iOS to ask for access to the user’s location whenever the user is using the app. If the app requires access to location data at all times, even in the background, you have to use Privacy – Location Always and When In Use Usage Description. iOS uses the value of this key as the reason on the alert when asking users for their location authorization.

Build and run the app again and try to allow location data once again.

Alert asking user to allow location access only once, while using the app or to deny access.

Success! iOS displays an alert asking permission for the user’s location. The user can choose either Allow Once, Allow While Using App or Don’t Allow.

“Allowing Once” will prompt the alert again the next time the user opens the app, whereas “Allow While Using App” allows the app to access the location data whenever the user is using the app.

Allow location data and the section toggle for location becomes enabled. Toggle the section to see the map with the user’s location.

Form with an image of a waterfall, a caption and a map with the user's location

Note: When running the app in the simulator, Xcode simulates a location for the device. If you want to test on other locations, you can go to DebugSimulate Location and select a specific location.

Handling Denied Authorization

So far so good. Users can select an image, add a caption and add their location data. But what happens if the user doesn’t allow location access?

Form with an image of waterfall, a caption and location section disabled

The view simply doesn’t have any feedback that the user previously denied access to location data. This can cause some confusion should the user later want to add location information. To fix this, you’ll add text explaining the user denied location data and a button for opening the Settings app to change the permission.

In NewPictureStore.swift, after showAllowLocationButton, add a new computed property:

var showOpenSettingsButton: Bool {
  locationAuthorizationStatus == .denied || 
    locationAuthorizationStatus == .restricted
}

This property returns true if the user denies access to location data. You’ll use it for showing the text and button for opening the Settings app.

Now, in NewPictureView.swift, find // TODO: Add open location settings button here and add the following code:

if store.showOpenSettingsButton {
  VStack(spacing: 16) {
    Text(locationDeniedText)
      .multilineTextAlignment(.center)
    Button("Open Location Settings", action: openLocationSettings)
      .font(.body.bold())
  }
}

This code adds a text explaining why they can’t add location and a button for opening the Settings app.

Build and run. Deny access to location data to see the new text and button.

Form with explanation why location is disabled and a button to take the user to the Settings app.

Note: If you allowed access to location data, open the Settings app, go to PrivacyLocation ServicesYourPrivacy and choose Never to see the new text and button.

Neat! Now users know why they don’t have access to the location section when they deny location data and also how to allow this if they want.

Handling accuracy

Now that users can allow access to their location, it’s time to handle accuracy. Like before, there’s no indication whether the user allows full accuracy or reduced accuracy. On Apple Maps, a button indicating full accuracy is off and asking for full accuracy helps users understand their data is not precise. You’ll add this button now.

Open Info.plist and add the following key as a dictionary:

  • Privacy – Location Temporary Usage Description Dictionary

Now, add the following key to the dictionary:

  • temporaryAccuracyLocation with the value of YourPrivacy uses location accuracy to better pinpoint the picture’s location.

This text describes the app’s reason for requesting full accuracy.

Back in NewPictureStore.swift, inside the Location Authorization extension, add the following code:

func requestTemporaryFullAccuracy() {
  locationManager.requestTemporaryFullAccuracyAuthorization(
    withPurposeKey: "temporaryAccuracyLocation"
  )
}

You call requestTemporaryFullAccuracyAuthorization(withPurposeKey:), passing the key you added in Info.plist, to show an alert asking for access to full accuracy with the reason you provided.

Finally, in NewPictureView.swift, add the following after // TODO: Precise location off button:

if store.locationAccuracyAuthorization == .reducedAccuracy {
  Button("Precise Location: Off", action: store.requestTemporaryFullAccuracy)
}

Build and run. Allow access to location data but leave precise location off to see the new button.

Alert requesting full accuracy location

Understanding iOS 14’s New Clipboard Prompt

To make iOS more transparent, Apple has focused on privacy-focused features already built into iOS. These features make apps a bit more transparent whenever they access data that the user might think is sensitive. The new Camera and Microphone indicators and Clipboard prompt help keep apps transparent when accessing this kind of data.

The clipboard has been available since iOS 3, and many users have been accustomed to it ever since its introduction on computers. However, nothing stood between an app accessing and tracking what the user has been copying and pasting. Apps have full access to read and write to the clipboard.

Starting with iOS 14, the system shows a new prompt whenever an app copies the content of the clipboard, even if it wasn’t an action from the user.

Form with a prompt at the top saying YourPrivacy pasted some text from Safari

That way, whenever an app reads from the clipboard, the user is aware of this and even knows where the content came from.

Understanding the New Camera and Microphone Indicators

The new indicators are also features to keep apps more transparent. Like the green light near the camera on MacBooks, iOS now displays a green circular dot at the top-right corner of the screen whenever an app uses the front-facing or rear camera.

Top view of the camera app with a green dot

Note: When the Differentiate Without Color setting is on, iOS uses a green square instead of a dot to indicate camera use.

And even after the app has stopped using the camera, you can still open the control center to see the name of the app that recently used the camera.

Top view of control center with text saying which app recently used the camera

The same is true for the microphone. Whenever an app uses the microphone, an orange dot will appear at the top-right corner of the screen.

Voice recorder app with an orange indicator at the top

These indicators keep users aware when an app accesses the camera and microphone, increasing transparency and awareness to the user and also preventing some embarrassing moments when leaving the camera on during a work call. :]