clarity and control - apple inc. · authorization modes review always authorization • access any...

92
#WWDC17 © 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Brad Jensen, Software Engineer What’s New in Location Technologies Clarity and control Session 713 System Frameworks

Upload: others

Post on 25-Jun-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

#WWDC17

© 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple.

Brad Jensen, Software Engineer

•What’s New in Location Technologies •Clarity and control • Session 713

System Frameworks

Page 2: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

•API improvements •Authorization and usage reporting •Best practices

Page 3: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

A Word of Warning Experience with Core Location is assumed

Core Location Best Practices WWDC 2016

Page 4: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

CLGeocoder ImprovementsNEW

Page 5: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

CLGeocoder Improvements

Updated to support Contacts framework

NEW

Page 6: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

CLGeocoder Improvements

Updated to support Contacts framework• Geocode CNPostalAddress

NEW

Page 7: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

CLGeocoder Improvements

Updated to support Contacts framework• Geocode CNPostalAddress• Obtain a CNPostalAddress from a CLPlacemark

NEW

Page 8: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

CLGeocoder Improvements

Updated to support Contacts framework• Geocode CNPostalAddress• Obtain a CNPostalAddress from a CLPlacemark• Address dictionary methods are deprecated

NEW

Page 9: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

CLGeocoder Improvements

Updated to support Contacts framework• Geocode CNPostalAddress• Obtain a CNPostalAddress from a CLPlacemark• Address dictionary methods are deprecated

Supports geocoding with a locale

NEW

Page 10: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

CLGeocoder Improvements

Updated to support Contacts framework• Geocode CNPostalAddress• Obtain a CNPostalAddress from a CLPlacemark• Address dictionary methods are deprecated

Supports geocoding with a locale• Overrides user preference

NEW

Page 11: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Heading vs. Course

Page 12: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Heading vs. Course

Heading

Page 13: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Heading vs. Course

Course

Heading

Page 14: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Heading vs. Course

Course

Heading

Page 15: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •
Page 16: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Course

Heading

Page 17: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •
Page 18: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Car Heading

iPhone Heading

Page 19: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Heading and Course Better together

Page 20: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Heading and Course Better together

Better heading estimates

Page 21: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Heading and Course Better together

Better heading estimates

Fully automatic

Page 22: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Heading and Course Better together

Better heading estimates

Fully automatic

Use CMDeviceMotion for raw heading

Creating Immersive Apps with Core Motion WWDC 2017

Page 23: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Indoor Positioning Improvements

Page 24: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Indoor Positioning Improvements

Accuracy

Page 25: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Indoor Positioning Improvements

Accuracy

Responsiveness

Page 26: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Indoor Positioning Improvements

Accuracy

Responsiveness

Availability

Page 27: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Indoor Positioning Improvements

Accuracy

Responsiveness

Availability

Interoperability

Page 28: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Continuous Background Location Now available on watchOS

NEW

Page 29: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Continuous Background Location Now available on watchOS

Continuous location extends to background

NEW

Page 30: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Continuous Background Location Now available on watchOS

Continuous location extends to background

Previously available through HealthKit

NEW

Page 31: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Continuous Background Location Now available on watchOS

Continuous location extends to background

Previously available through HealthKit

Good for navigation and fitness apps

NEW

Page 32: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Continuous Background Location Now available on watchOS

Continuous location extends to background

Previously available through HealthKit

Good for navigation and fitness apps

Workout apps must adopt

NEW

Page 33: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Continuous Background Location Now available on watchOS

Continuous location extends to background

Previously available through HealthKit

Good for navigation and fitness apps

Workout apps must adopt

Three easy steps

NEW

Page 34: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Continuous Background Location Now available on watchOS

Continuous location extends to background

Previously available through HealthKit

Good for navigation and fitness apps

Workout apps must adopt

Three easy steps

NEW

Page 35: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Continuous Background Location Now available on watchOS

Continuous location extends to background

Previously available through HealthKit

Good for navigation and fitness apps

Workout apps must adopt

Three easy steps

locationManager.allowsBackgroundLocationUpdates = true

NEW

Page 36: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Continuous Background Location Now available on watchOS

Continuous location extends to background

Previously available through HealthKit

Good for navigation and fitness apps

Workout apps must adopt

Three easy steps

locationManager.allowsBackgroundLocationUpdates = truelocationManager.startUpdatingLocation() // While in the foreground!!

NEW

Page 37: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Best Practices for Workout Apps

Page 38: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Best Practices for Workout Apps

Use HKWorkoutSession

Page 39: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Best Practices for Workout Apps

Use HKWorkoutSession

Use CMPedometer for pedestrian distance

Page 40: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

•Authorization and Usage Reporting

Page 41: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Authorization Modes Review

Page 42: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Authorization Modes Review

Always authorization • Access any time the app is running • Background monitoring APIs

Service

Region Monitoring

Significant Location Change Monitoring

Visit Monitoring

Standard Location

Continuous Background Location

Ranging

Available with Always

Page 43: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Authorization Modes Review

Always authorization • Access any time the app is running • Background monitoring APIs

WhenInUse authorization • Access only when “in use” • Improved user control

Service

Region Monitoring

Significant Location Change Monitoring

Visit Monitoring

Standard Location

Continuous Background Location

Ranging

Available with Always

Available with WhenInUse

Page 44: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Authorization Modes Percentage Breakdown

79%

21%

Always only

WhenInUse support

Page 45: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Motivations for Requiring Always

Page 46: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Motivations for Requiring Always

Developer confusion

Page 47: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Motivations for Requiring Always

Developer confusion

Pursuit of magical experiences

Page 48: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Always Authorization in iOS 11

Page 49: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Always Authorization in iOS 11

WhenInUse support is required

Page 50: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Always Authorization in iOS 11

WhenInUse support is required• Legacy apps included

Page 51: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Always Authorization in iOS 11

WhenInUse support is required• Legacy apps includedNSLocationWhenInUseUsageDescription

Page 52: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Always Authorization in iOS 11

WhenInUse support is required• Legacy apps includedNSLocationWhenInUseUsageDescription

Prompts for Always include WhenInUse option

Page 53: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Always Authorization in iOS 11

WhenInUse support is required• Legacy apps includedNSLocationWhenInUseUsageDescription

Prompts for Always include WhenInUse optionNSLocationAlwaysAndWhenInUseUsageDescription

Page 54: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Always Authorization in iOS 11

WhenInUse support is required• Legacy apps includedNSLocationWhenInUseUsageDescription

Prompts for Always include WhenInUse optionNSLocationAlwaysAndWhenInUseUsageDescription

• Always-using apps must adopt

Page 55: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Supporting Always Authorization Best practices

Page 56: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Supporting Always Authorization Best practices

Support older iOS builds and provide all keysNSLocationWhenInUseUsageDescriptionNSLocationAlwaysAndWhenInUseUsageDescriptionNSLocationAlwaysUsageDescription

Page 57: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Supporting Always Authorization Best practices

Support older iOS builds and provide all keysNSLocationWhenInUseUsageDescriptionNSLocationAlwaysAndWhenInUseUsageDescriptionNSLocationAlwaysUsageDescription

Help the user choose

Page 58: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Supporting Always Authorization Best practices

Support older iOS builds and provide all keysNSLocationWhenInUseUsageDescriptionNSLocationAlwaysAndWhenInUseUsageDescriptionNSLocationAlwaysUsageDescription

Help the user choose• Explain what each authorization mode enables

Page 59: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Requesting Authorization Best practices

Page 60: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Requesting Authorization Best practices

Ask for authorization when you need it

Page 61: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Requesting Authorization Best practices

Ask for authorization when you need it

Request WhenInUse first

Page 62: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Requesting Authorization Best practices

Ask for authorization when you need it

Request WhenInUse first• Always features are an addition to WhenInUse experience

Page 63: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Requesting Authorization Best practices

Ask for authorization when you need it

Request WhenInUse first• Always features are an addition to WhenInUse experience• Transition from WhenInUse to Always later

Page 64: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

From WhenInUse to Always

Page 65: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

From WhenInUse to Always

Not Determined

Page 66: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

From WhenInUse to Always

Not Determined

WhenInUse NeverAlways

NSLocationWhenInUseUsageDescription

Request WhenInUse

Page 67: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

From WhenInUse to Always

Not Determined

WhenInUse NeverAlways

NSLocationWhenInUseUsageDescription

Request WhenInUse

Request Always

WhenInUse NeverAlways

NSLocationAlwaysAndWhenInUseUsageDescription

Page 68: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

From WhenInUse to Always

Not Determined

WhenInUse NeverAlways

NSLocationWhenInUseUsageDescription

Request WhenInUse

Request Always

WhenInUse NeverAlways

NSLocationAlwaysAndWhenInUseUsageDescription

WhenInUse NeverAlways

Request Always

Page 69: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •
Page 70: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indication iOS 10

Page 71: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indication iOS 10

Based on requested service

Page 72: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indication iOS 10

Based on requested service

Page 73: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indication iOS 10

Based on requested service

Page 74: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indication iOS 10

Based on requested service

WhenInUse required for blue status bar

Page 75: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indication iOS 10

Based on requested service

WhenInUse required for blue status bar

Room for improvement

Page 76: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indication iOS 10

Based on requested service

WhenInUse required for blue status bar

Room for improvement• Over-represented some services

Page 77: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indication iOS 10

Based on requested service

WhenInUse required for blue status bar

Room for improvement• Over-represented some services• Blue bar inconsistency

Page 78: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indication iOS 10

Based on requested service

WhenInUse required for blue status bar

Room for improvement• Over-represented some services• Blue bar inconsistency • Users could get the wrong impression

Page 79: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indicators New behavior

Page 80: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indicators New behavior

New arrow policy

Page 81: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indicators New behavior

New arrow policy• Hollow arrow when requesting

Page 82: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indicators New behavior

New arrow policy• Hollow arrow when requesting• Solid arrow when receiving

Page 83: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indicators New behavior

New arrow policy• Hollow arrow when requesting• Solid arrow when receiving

Blue status bar for Always apps

Page 84: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indicators New behavior

New arrow policy• Hollow arrow when requesting• Solid arrow when receiving

Blue status bar for Always apps

Matches user expectations

Page 85: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Location Usage Indicators New behavior

New arrow policy• Hollow arrow when requesting• Solid arrow when receiving

Blue status bar for Always apps

Matches user expectations

Better for developers

Page 86: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Arrow Icon Example

Page 87: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Arrow Icon Example

Page 88: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Summary

Users have more control

Communicate with the user

Build a WhenInUse-first experience

Page 89: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

More Informationhttps://developer.apple.com/wwdc17/713

Page 90: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Related Sessions

Privacy and Your Apps WWDC 2017

Creating Immersive Apps with Core Motion WWDC 2017

Page 91: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •

Labs

Location and Mapping Technologies Lab Technology Lab C Thur 4:10PM–6:00PM

Location and Mapping Technologies Lab Technology Lab K Fri 10:00AM–12:00PM

Page 92: Clarity and control - Apple Inc. · Authorization Modes Review Always authorization • Access any time the app is running • Background monitoring APIs WhenInUse authorization •