what’s new in core location - apple developer · what’s new in core location location...

257
© 2014 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. What’s New in Core Location Session 706 Stephen Rhee Engineering Manager Core OS

Upload: others

Post on 25-Jun-2020

10 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

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

What’s New in Core Location

Session 706 Stephen Rhee Engineering Manager

Core OS

Page 2: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

What’s New in Core Location

Page 3: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

What’s New in Core Location

Location authorization

Page 4: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

What’s New in Core Location

Location authorization

Visit monitoring

Page 5: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

What’s New in Core Location

Location authorization

Visit monitoring

Indoor positioning

Page 6: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

IntroductionA brief history

Page 7: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

IntroductionA brief history

iOS 2

Location

Page 8: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

IntroductionA brief history

iOS 2

Location

iOS 3

Heading

Page 9: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

IntroductionA brief history

iOS 2

Location

iOS 3

Heading

iOS 4

Backgroundlocation

Region monitoring

Significant location changes

Page 10: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

IntroductionA brief history

iOS 2

Location

iOS 3

Heading

iOS 5

Geocoding

iOS 4

Backgroundlocation

Region monitoring

Significant location changes

Page 11: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

IntroductionA brief history

iOS 2

Location

iOS 3

Heading

iOS 5

Geocoding

iOS 6

Deferred locationupdates

iOS 4

Backgroundlocation

Region monitoring

Significant location changes

Page 12: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

IntroductionA brief history

iOS 2

Location

iOS 3

Heading

iOS 5

Geocoding

iOS 6

Deferred locationupdates

iOS 7

iBeacon

iOS 4

Backgroundlocation

Region monitoring

Significant location changes

Page 13: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location
Page 14: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Apps using location680,000

Page 15: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Apps using location680,000

Navigation

Page 16: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Apps using location680,000

NavigationTravel

Page 17: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Apps using location680,000

NavigationTravel

Fitness

Page 18: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Apps using location680,000

NavigationTravel

Fitness

Shopping

Page 19: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Apps using location680,000

NavigationTravel

Fitness

Shopping

Social

Page 20: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Apps using location680,000

NavigationTravel

Fitness

Shopping

SocialGaming

Page 21: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

IntroductionLocation indication

Page 22: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Status bar icon

IntroductionLocation indication

Page 23: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Status bar icon• Solid

IntroductionLocation indication

Page 24: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Status bar icon• Solid

- Location

- Ranging

- Significant location changes

IntroductionLocation indication

Page 25: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Status bar icon• Solid

- Location

- Ranging

- Significant location changes

IntroductionLocation indication

Page 26: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Status bar icon• Solid

- Location

- Ranging

- Significant location changes

• Hollow

IntroductionLocation indication

Page 27: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Status bar icon• Solid

- Location

- Ranging

- Significant location changes

• Hollow

- Region monitoring only

IntroductionLocation indication

Page 28: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Status bar icon• Solid

- Location

- Ranging

- Significant location changes

• Hollow

- Region monitoring only

IntroductionLocation indication

Page 29: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

IntroductionLocation Services settings

Page 30: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Settings > Privacy > Location Services

IntroductionLocation Services settings

Page 31: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Settings > Privacy > Location Services• Global control

IntroductionLocation Services settings

Page 32: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Settings > Privacy > Location Services• Global control

• Per app control

IntroductionLocation Services settings

Page 33: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Settings > Privacy > Location Services• Global control

• Per app control

• Per app usage

IntroductionLocation Services settings

Page 34: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Settings > Privacy > Location Services• Global control

• Per app control

• Per app usage

- Recent

IntroductionLocation Services settings

Page 35: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Settings > Privacy > Location Services• Global control

• Per app control

• Per app usage

- Recent

- Within last 24 hours

IntroductionLocation Services settings

Page 36: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Settings > Privacy > Location Services• Global control

• Per app control

• Per app usage

- Recent

- Within last 24 hours

- Region monitoring

IntroductionLocation Services settings

Page 37: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

IntroductionLocation authorization

Page 38: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

IntroductionLocation authorization

Request for authorization • For all location functionality

Page 39: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

IntroductionLocation authorization

Request for authorization • For all location functionality

Text is customizable by the app

Page 40: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location Authorization

Page 41: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAuthorization types

Page 42: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAuthorization types

Continuous Updates

Location

Background location

Ranging

Page 43: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAuthorization types

Continuous Updates

Location

Background location

Ranging

Location Monitoring

Region monitoring

Significant location changes

Page 44: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAuthorization types

Continuous Updates

Location

Background location

Ranging

Always

Location Monitoring

Region monitoring

Significant location changes

Page 45: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAuthorization types

Continuous Updates

Location

Background location

Ranging

Always

WhenInUse

Location Monitoring

Region monitoring

Significant location changes

Page 46: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationBackground location

Page 47: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Continuous background location • Specified statically by the app

• Started in the foreground

• Available with WhenInUse authorization

Location AuthorizationBackground location

Page 48: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Continuous background location • Specified statically by the app

• Started in the foreground

• Available with WhenInUse authorization

Location AuthorizationBackground location

Page 49: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Continuous background location • Specified statically by the app

• Started in the foreground

• Available with WhenInUse authorization

Location in the background • Invoked from the background

- For example, Background App Refresh

• Requires Always authorization

Location AuthorizationBackground location

Page 50: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationMultitasking

Page 51: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationMultitasking

App switcher quit • Stops continuous background location

• Does not stop location monitoring

Page 52: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationMultitasking

App switcher quit • Stops continuous background location

• Does not stop location monitoring

Background App Refresh • No longer disables location

Page 53: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationWhat the user sees

Page 54: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationRequesting authorization

Page 55: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationRequesting authorization

Apps explicitly request authorization • For either WhenInUse or Always

Page 56: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationRequesting authorization

Apps explicitly request authorization • For either WhenInUse or Always

Page 57: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationRequesting authorization

Apps explicitly request authorization • For either WhenInUse or Always

Dialog will only be presented once

Page 58: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationRequesting authorization

Apps explicitly request authorization • For either WhenInUse or Always

Dialog will only be presented once

Text is customizable by the app

Page 59: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationRequesting authorization

Apps explicitly request authorization • For either WhenInUse or Always

Dialog will only be presented once

Text is customizable by the app

Page 60: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAlways authorization

Page 61: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAlways authorization

User will be asked again a few days later • Only if Always authorization exercised

Page 62: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAlways authorization

User will be asked again a few days later • Only if Always authorization exercised

Page 63: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAlways authorization

User will be asked again a few days later • Only if Always authorization exercised

Text is customizable by the app

Page 64: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationLocation Services settings

Page 65: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationLocation Services settings

Apps support WhenInUse and/or Always • Specified statically by the app

Page 66: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationLocation Services settings

Apps support WhenInUse and/or Always • Specified statically by the app

Page 67: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationLocation Services settings

Apps support WhenInUse and/or Always • Specified statically by the app

Page 68: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationLocation Services settings

Apps support WhenInUse and/or Always • Specified statically by the app

Page 69: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationLocation Services settings

Apps support WhenInUse and/or Always • Specified statically by the app

Page 70: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationApp settings

Page 71: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationApp settings

Now has link to Privacy • Includes Location Services

Page 72: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationApp settings

Now has link to Privacy • Includes Location Services

Page 73: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationApp settings

Now has link to Privacy • Includes Location Services

Page 74: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationApp settings

Now has link to Privacy • Includes Location Services

Page 75: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationApp settings

Now has link to Privacy • Includes Location Services

Now able to open Settings directly for the app [[UIApplication sharedApplication] openURL: [NSURL URLWithString: UIApplicationOpenSettingsURLString]];

Page 76: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationDeveloper adoption

Page 77: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption

Page 78: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption

Info.plist keys

Page 79: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption

Info.plist keys

Authorization status enum values

Page 80: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption

Info.plist keys

Authorization status enum values

Authorization request APIs

Page 81: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption—Info.plist keys

Page 82: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

NSLocationUsageDescription

Location AuthorizationAdoption—Info.plist keys

Page 83: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

NSLocationUsageDescriptionNSLocationAlwaysUsageDescriptionNSLocationWhenInUseUsageDescription

Location AuthorizationAdoption—Info.plist keys

At least one is mandatory

Page 84: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption—Authorization status enum values

Page 85: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

CLAuthorizationStatuskCLAuthorizationStatusNotDeterminedkCLAuthorizationStatusRestrictedkCLAuthorizationStatusDeniedkCLAuthorizationStatusAuthorized

Location AuthorizationAdoption—Authorization status enum values

Page 86: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

CLAuthorizationStatuskCLAuthorizationStatusNotDeterminedkCLAuthorizationStatusRestrictedkCLAuthorizationStatusDeniedkCLAuthorizationStatusAuthorizedkCLAuthorizationStatusAuthorizedAlwayskCLAuthorizationStatusAuthorizedWhenInUse

Location AuthorizationAdoption—Authorization status enum values

Page 87: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption—Authorization request APIs

Page 88: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption—Authorization request APIs

- (void)requestAlwaysAuthorization;

Page 89: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption—Authorization request APIs

- (void)requestAlwaysAuthorization;- (void)requestWhenInUseAuthorization;

Page 90: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Page 91: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Decide which authorization

Page 92: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Decide which authorization• What location functionality does your app use?

Page 93: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Decide which authorization• What location functionality does your app use?

• Is it mandatory or nice to have?

Page 94: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Decide which authorization• What location functionality does your app use?

• Is it mandatory or nice to have?

Add the keys to your Info.plist

Page 95: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Decide which authorization• What location functionality does your app use?

• Is it mandatory or nice to have?

Add the keys to your Info.plist• Explain how your app uses location

Page 96: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Decide which authorization• What location functionality does your app use?

• Is it mandatory or nice to have?

Add the keys to your Info.plist• Explain how your app uses location

Make the right API call

Page 97: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Decide which authorization• What location functionality does your app use?

• Is it mandatory or nice to have?

Add the keys to your Info.plist• Explain how your app uses location

Make the right API call• Do it when needed

Page 98: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationExample—Fitness app

Page 99: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used

Location AuthorizationExample—Fitness app

Page 100: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Background location

Location AuthorizationExample—Fitness app

Page 101: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Background location

Location AuthorizationExample—Fitness app

Page 102: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Background location

Location AuthorizationExample—Fitness app

Page 103: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Background location

Location AuthorizationExample—Fitness app

Page 104: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Background location

Add the key to the app’s information property list

Location AuthorizationExample—Fitness app

Page 105: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Background location

Add the key to the app’s information property list

Location AuthorizationExample—Fitness app

Page 106: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Background location

Add the key to the app’s information property list

Location AuthorizationExample—Fitness app

Page 107: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Background location

Add the key to the app’s information property list

Make the corresponding authorization request API call

Location AuthorizationExample—Fitness app

Page 108: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Background location

Add the key to the app’s information property list

Make the corresponding authorization request API callCLLocationManager *locationManager = [[CLLocationManager alloc] init];locationManager.delegate = self;[locationManager requestWhenInUseAuthorization];[locationManager startUpdatingLocation];

Location AuthorizationExample—Fitness app

Page 109: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationExample—WelcomeHome app

Page 110: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used

Location AuthorizationExample—WelcomeHome app

Page 111: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Region monitoring

Location AuthorizationExample—WelcomeHome app

Page 112: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Region monitoring

Add the key to the app’s information property list

Location AuthorizationExample—WelcomeHome app

Page 113: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Region monitoring

Add the key to the app’s information property list

Location AuthorizationExample—WelcomeHome app

Page 114: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Region monitoring

Add the key to the app’s information property list

Location AuthorizationExample—WelcomeHome app

Page 115: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Region monitoring

Add the key to the app’s information property list

Make the corresponding authorization request API call

Location AuthorizationExample—WelcomeHome app

Page 116: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Region monitoring

Add the key to the app’s information property list

Make the corresponding authorization request API callCLLocationManager *locationManager = [[CLLocationManager alloc] init];locationManager.delegate = self;CLCircularRegion *region = [[CLCircularRegion alloc] initWithCenter:center radius:radius identifier:identifier];[locationManager requestAlwaysAuthorization];[locationManager startMonitoringForRegion:region];

Location AuthorizationExample—WelcomeHome app

Page 117: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationExample—AmusementPark app

Page 118: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used

Location AuthorizationExample—AmusementPark app

Page 119: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Region monitoring

Location AuthorizationExample—AmusementPark app

Page 120: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Region monitoring

Add the keys to the app’s information property list

Location AuthorizationExample—AmusementPark app

Page 121: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Region monitoring

Add the keys to the app’s information property list

Location AuthorizationExample—AmusementPark app

Page 122: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Region monitoring

Add the keys to the app’s information property list

Location AuthorizationExample—AmusementPark app

Page 123: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Region monitoring

Add the keys to the app’s information property list

Location AuthorizationExample—AmusementPark app

Page 124: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Region monitoring

Add the keys to the app’s information property list

Location AuthorizationExample—AmusementPark app

Page 125: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Region monitoring

Add the keys to the app’s information property list

Location AuthorizationExample—AmusementPark app

Page 126: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Region monitoring

Add the keys to the app’s information property list

Location AuthorizationExample—AmusementPark app

Page 127: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Region monitoring

Add the keys to the app’s information property list

Make the corresponding authorization request API call

Location AuthorizationExample—AmusementPark app

Page 128: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Determine how location is used• Location

• Region monitoring

Add the keys to the app’s information property list

Make the corresponding authorization request API call// user opened the map view[locationManager requestWhenInUseAuthorization];[locationManager startUpdatingLocation];

Location AuthorizationExample—AmusementPark app

Page 129: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationExample—AmusementPark app

Page 130: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationExample—AmusementPark app

Make the corresponding authorization request API call

Page 131: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationExample—AmusementPark app

Make the corresponding authorization request API call// user activated automatic attraction info mode

Page 132: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationExample—AmusementPark app

Make the corresponding authorization request API call// user activated automatic attraction info modeCLAuthorizationStatus status = [CLLocationManager authorizationStatus];if (authorizationStatus == kCLAuthorizationStatusDenied || authorizationStatus == kCLAuthorizationStatusWhenInUse) {

Page 133: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationExample—AmusementPark app

Make the corresponding authorization request API call// user activated automatic attraction info modeCLAuthorizationStatus status = [CLLocationManager authorizationStatus];if (authorizationStatus == kCLAuthorizationStatusDenied || authorizationStatus == kCLAuthorizationStatusWhenInUse) { // present an alert indicating location authorization required // and offer to take the user to Settings for the app via // UIApplication -openUrl: and UIApplicationOpenSettingsURLString}

Page 134: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationExample—AmusementPark app

Make the corresponding authorization request API call// user activated automatic attraction info modeCLAuthorizationStatus status = [CLLocationManager authorizationStatus];if (authorizationStatus == kCLAuthorizationStatusDenied || authorizationStatus == kCLAuthorizationStatusWhenInUse) { // present an alert indicating location authorization required // and offer to take the user to Settings for the app via // UIApplication -openUrl: and UIApplicationOpenSettingsURLString}[locationManager requestAlwaysAuthorization];[locationManager startMonitoringForRegion:region];

Page 135: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationTargeting iOS 7 and iOS 8

Page 136: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationTargeting iOS 7 and iOS 8

Continue to provide the deprecated NSLocationUsageDescription

Page 137: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationTargeting iOS 7 and iOS 8

Continue to provide the deprecated NSLocationUsageDescription

Guard the request authorization API calls with respondsToSelector:

Page 138: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationTargeting iOS 7 and iOS 8

Continue to provide the deprecated NSLocationUsageDescription

Guard the request authorization API calls with respondsToSelector:if ([locationManager respondsToSelector: @selector(requestAlwaysAuthorization)]) { [locationManager requestAlwaysAuthorization];}

Page 139: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationTargeting iOS 7 and iOS 8

Continue to provide the deprecated NSLocationUsageDescription

Guard the request authorization API calls with respondsToSelector:if ([locationManager respondsToSelector: @selector(requestAlwaysAuthorization)]) { [locationManager requestAlwaysAuthorization];}

Continue to use the deprecated kCLAuthorizationStatusAuthorized value

Page 140: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationLegacy app support

Page 141: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationLegacy app support

Legacy apps will still continue to work

Page 142: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationLegacy app support

Legacy apps will still continue to work• Will use Always authorization

Page 143: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationUpdating your app

Page 144: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationUpdating your app

Can change supported authorizations between versions

Page 145: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationUpdating your app

Can change supported authorizations between versions• Will preserve user’s authorization if still supported

Page 146: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationUpdating your app

Can change supported authorizations between versions• Will preserve user’s authorization if still supported

• Otherwise:

Page 147: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationUpdating your app

Can change supported authorizations between versions• Will preserve user’s authorization if still supported

• Otherwise:

- Will go from Always to WhenInUse

Page 148: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationUpdating your app

Can change supported authorizations between versions• Will preserve user’s authorization if still supported

• Otherwise:

- Will go from Always to WhenInUse

- Will go from WhenInUse to prompt again

Page 149: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationOther frameworks

Page 150: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationUILocalNotification

Page 151: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationUILocalNotification

Now supports region-based triggering

Page 152: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationUILocalNotification

Now supports region-based triggering@property(nonatomic,retain) CLRegion *region;

Page 153: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationUILocalNotification

Now supports region-based triggering@property(nonatomic,retain) CLRegion *region;

Requires either authorization

Page 154: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationUILocalNotification

Now supports region-based triggering@property(nonatomic,retain) CLRegion *region;

Requires either authorization• Specify the desired key in the Info.plist

Page 155: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationUILocalNotification

Now supports region-based triggering@property(nonatomic,retain) CLRegion *region;

Requires either authorization• Specify the desired key in the Info.plist

• Call the corresponding authorization request API

Page 156: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationMKMapView

Page 157: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationMKMapView

When displaying the user’s location

Page 158: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationMKMapView

When displaying the user’s location@property (nonatomic) BOOL showsUserLocation;

Page 159: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationMKMapView

When displaying the user’s location@property (nonatomic) BOOL showsUserLocation;

Requires either authorization

Page 160: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationMKMapView

When displaying the user’s location@property (nonatomic) BOOL showsUserLocation;

Requires either authorization• Specify the desired key in the Info.plist

Page 161: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationMKMapView

When displaying the user’s location@property (nonatomic) BOOL showsUserLocation;

Requires either authorization• Specify the desired key in the Info.plist

• Call the corresponding authorization request API

Page 162: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationWeb views

Page 163: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationWeb views

To allow web content that uses HTML5 geolocation

Page 164: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationWeb views

To allow web content that uses HTML5 geolocation

Requires either authorization

Page 165: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationWeb views

To allow web content that uses HTML5 geolocation

Requires either authorization• Specify the desired key in the Info.plist

Page 166: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationWeb views

To allow web content that uses HTML5 geolocation

Requires either authorization• Specify the desired key in the Info.plist

WhenInUse authorization will be requested when needed

Page 167: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationWeb views

To allow web content that uses HTML5 geolocation

Requires either authorization• Specify the desired key in the Info.plist

WhenInUse authorization will be requested when needed• Request Always authorization in advance if desired

Page 168: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Page 169: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Get ready for iOS 8

Page 170: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Get ready for iOS 8• Think about how you use location

Page 171: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Get ready for iOS 8• Think about how you use location

• Explain it to your users

Page 172: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Location AuthorizationAdoption recap

Get ready for iOS 8• Think about how you use location

• Explain it to your users

• Make the call to request authorization

Page 173: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Visit Monitoring

Brad Jensen Software Engineer

Page 174: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Let’s Write a Journaling App

Page 175: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Let’s Write a Journaling App

Provide the user a list of places they’ve been

Page 176: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Let’s Write a Journaling App

Provide the user a list of places they’ve been

Low noise

Page 177: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Let’s Write a Journaling App

Provide the user a list of places they’ve been

Low noise

Suitable for 24/7 use

Page 178: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIStandard location service

Page 179: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIStandard location service

Requires keeping device awake

Page 180: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIStandard location service

Requires keeping device awake

Requires frequent wifi, cell, or GPS scans

Page 181: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIStandard location service

Requires keeping device awake

Requires frequent wifi, cell, or GPS scans

Lots of irrelevant data

Page 182: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIStandard location service

Requires keeping device awake

Requires frequent wifi, cell, or GPS scans

Lots of irrelevant data

Much better suited for navigation

Page 183: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIImproving standard location service

Page 184: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIImproving standard location service

Automatic pause

Page 185: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIImproving standard location service

Automatic pause• Saves power while the device isn’t moving

Page 186: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIImproving standard location service

Automatic pause• Saves power while the device isn’t moving

• Doesn’t help while it is moving

Page 187: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIImproving standard location service

Automatic pause• Saves power while the device isn’t moving

• Doesn’t help while it is moving

• Makes sense for navigation

Page 188: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIImproving standard location service

Automatic pause• Saves power while the device isn’t moving

• Doesn’t help while it is moving

• Makes sense for navigation

Deferred location updates

Page 189: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIImproving standard location service

Automatic pause• Saves power while the device isn’t moving

• Doesn’t help while it is moving

• Makes sense for navigation

Deferred location updates• Saves power by waking your app less

Page 190: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIImproving standard location service

Automatic pause• Saves power while the device isn’t moving

• Doesn’t help while it is moving

• Makes sense for navigation

Deferred location updates• Saves power by waking your app less

• Generating locations is expensive

Page 191: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIImproving standard location service

Automatic pause• Saves power while the device isn’t moving

• Doesn’t help while it is moving

• Makes sense for navigation

Deferred location updates• Saves power by waking your app less

• Generating locations is expensive

• Great for fitness apps

Page 192: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APISignificant location changes

Page 193: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APISignificant location changes

Lower power cost than continuous updates

Page 194: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APISignificant location changes

Lower power cost than continuous updates

Very coarse tracks

Page 195: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APISignificant location changes

Lower power cost than continuous updates

Very coarse tracks

Hard to identify stops

Page 196: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIRegion monitoring

Page 197: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIRegion monitoring

Great power efficiency

Page 198: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIRegion monitoring

Great power efficiency

Relevant data

Page 199: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIRegion monitoring

Great power efficiency

Relevant data

Needs a specific region to monitor

Page 200: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Existing APIRegion monitoring

Great power efficiency

Relevant data

Needs a specific region to monitor

Limited number of regions

Page 201: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Introducing Visit Monitoring

Page 202: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Introducing Visit Monitoring

Monitors for destinations

Page 203: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Introducing Visit Monitoring

Monitors for destinations

Launches your app when when it detects a visit

Page 204: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Introducing Visit Monitoring

Monitors for destinations

Launches your app when when it detects a visit

Requires always authorization

Page 205: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Introducing Visit Monitoring

Monitors for destinations

Launches your app when when it detects a visit

Requires always authorization

Power efficient

Page 206: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Introducing Visit Monitoring

Monitors for destinations

Launches your app when when it detects a visit

Requires always authorization

Power efficient

Opportunistic location use

Page 207: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Introducing Visit Monitoring

Monitors for destinations

Launches your app when when it detects a visit

Requires always authorization

Power efficient

Opportunistic location use

Utilizes information from the whole system

Page 208: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Introducing Visit Monitoring

Monitors for destinations

Launches your app when when it detects a visit

Requires always authorization

Power efficient

Opportunistic location use

Utilizes information from the whole system

Not tied to landmarks

Page 209: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Anatomy of a Visit

Coffee Shop

Home

Page 210: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Anatomy of a Visit

Coffee Shop

Home

Page 211: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Anatomy of a Visit

Coffee Shop

Home

ArrivalDelivered

ArrivalTime

Page 212: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Anatomy of a Visit

Coffee Shop

Home

ArrivalDelivered

ArrivalTime

Page 213: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Anatomy of a Visit

Coffee Shop

Home

ArrivalDelivered

DepartureTime

ArrivalTime

DepartureDelivered

Page 214: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Visit Monitoring APICLLocationManager

Page 215: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Visit Monitoring APICLLocationManager

@interface CLLocationManager (CLVisitExtensions) - (void)startMonitoringVisits; - (void)stopMonitoringVisits; @end !

Page 216: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Visit Monitoring APICLLocationManager

@interface CLLocationManager (CLVisitExtensions) - (void)startMonitoringVisits; - (void)stopMonitoringVisits; @end !

@protocol CLLocationManagerDelegate<NSObject> @optional - (void)locationManager:(CLLocationManager *)manager didVisit:(CLVisit *)visit; @end

Page 217: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Visit Monitoring APICLVisit

@interface CLVisit : NSObject <NSSecureCoding, NSCopying> @property (nonatomic, readonly, copy) NSDate *arrivalDate; @property (nonatomic, readonly, copy) NSDate *departureDate; @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; @property (nonatomic, readonly) CLLocationAccuracy horizontalAccuracy; @end

Page 218: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Visit Monitoring APICLVisit

@interface CLVisit : NSObject <NSSecureCoding, NSCopying> @property (nonatomic, readonly, copy) NSDate *arrivalDate; @property (nonatomic, readonly, copy) NSDate *departureDate; @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; @property (nonatomic, readonly) CLLocationAccuracy horizontalAccuracy; @end

Page 219: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Visit Monitoring APICLVisit

@interface CLVisit : NSObject <NSSecureCoding, NSCopying> @property (nonatomic, readonly, copy) NSDate *arrivalDate; @property (nonatomic, readonly, copy) NSDate *departureDate; @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; @property (nonatomic, readonly) CLLocationAccuracy horizontalAccuracy; @end

Page 220: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Visit Monitoring APICLVisit

@interface CLVisit : NSObject <NSSecureCoding, NSCopying> @property (nonatomic, readonly, copy) NSDate *arrivalDate; @property (nonatomic, readonly, copy) NSDate *departureDate; @property (nonatomic, readonly) CLLocationCoordinate2D coordinate; @property (nonatomic, readonly) CLLocationAccuracy horizontalAccuracy; @end

Page 221: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Visit Monitoring APINotes

Page 222: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Visit Monitoring APINotes

Values of horizontalAccuracy and coordinate may differ

Page 223: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Visit Monitoring APINotes

Values of horizontalAccuracy and coordinate may differ

Triggers app launches even when quit

Page 224: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Visit Monitoring APINotes

Values of horizontalAccuracy and coordinate may differ

Triggers app launches even when quit

Multiple visits may be delivered

Page 225: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Identifying Arrivals

arrivalDate departureDate

Page 226: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Identifying Arrivals

arrivalDate departureDate

Arrival Arrival estimate [NSDate distantFuture]

Page 227: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Identifying Arrivals

arrivalDate departureDate

Arrival Arrival estimate [NSDate distantFuture]

Departure [NSDate distantPast] OR arrival estimate

Departure estimate

Page 228: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Identifying Arrivals

- (BOOL)isArrivalVisit:(CLVisit *)visit { return [visit.departureDate isEqual:[NSDate distantFuture]]; }

arrivalDate departureDate

Arrival Arrival estimate [NSDate distantFuture]

Departure [NSDate distantPast] OR arrival estimate

Departure estimate

Page 229: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Back to the AppPlan

Page 230: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Back to the AppPlan

Adopt new authorization

Page 231: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Back to the AppPlan

Adopt new authorization

Create a CLLocationManager

Page 232: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Back to the AppPlan

Adopt new authorization

Create a CLLocationManager

Write start and stop methods

Page 233: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Back to the AppPlan

Adopt new authorization

Create a CLLocationManager

Write start and stop methods

Handle visits

Page 234: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Back to the AppAdopt new authorization

Page 235: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Back to the AppAdopt new authorization

Page 236: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Back to the AppCreate a CLLocationManager

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { !

self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; !

return YES; }

Page 237: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Back to the AppWrite start and stop methods

Page 238: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Back to the AppWrite start and stop methods

- (void)startJournaling { [self.locationManager requestAlwaysAuthorization]; [self.locationManager startMonitoringVisits]; }

Page 239: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Back to the AppWrite start and stop methods

- (void)startJournaling { [self.locationManager requestAlwaysAuthorization]; [self.locationManager startMonitoringVisits]; }

- (void)stopJournaling { [self.locationManager stopMonitoringVisits]; }

Page 240: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Back to the AppHandle visits

- (void)locationManager:(CLLocationManager *)manager didVisit:(CLVisit *)visit { // Your turn }

Page 241: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Final WordsAdvice

Page 242: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Final WordsAdvice

Visit monitoring doesn’t replace region monitoring

Page 243: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Final WordsAdvice

Visit monitoring doesn’t replace region monitoring

It also doesn’t replace significant location change monitoring

Page 244: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Final WordsAdvice

Visit monitoring doesn’t replace region monitoring

It also doesn’t replace significant location change monitoring

Try it out

Page 245: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Final WordsAdvice

Visit monitoring doesn’t replace region monitoring

It also doesn’t replace significant location change monitoring

Try it out

See if visit monitoring can do what you need

Page 246: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Final WordsAdvice

Visit monitoring doesn’t replace region monitoring

It also doesn’t replace significant location change monitoring

Try it out

See if visit monitoring can do what you need

Come to our lab session

Page 247: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Final WordsAdvice

Visit monitoring doesn’t replace region monitoring

It also doesn’t replace significant location change monitoring

Try it out

See if visit monitoring can do what you need

Come to our lab session

Respect your users’ privacy

Page 248: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

What’s Next?

Page 249: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Indoor Positioning

Page 250: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Indoor Positioning

• Taking Core Location Indoors Marina Tuesday 3:15PM

Page 251: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Summary

Page 252: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Summary

Authorization • Think about how you use location

• Explain it to your users

• Make the call to request authorization

Page 253: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Summary

Authorization • Think about how you use location

• Explain it to your users

• Make the call to request authorization

Visit monitoring • Assess your needs for location

• Respect your users’ privacy

• Try it out

Page 254: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

More Information

Craig Keithley MFi and I/O Technologies Evangelist [email protected]

Documentation Core Location Framework Reference http://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CoreLocation_Framework/_index.html

Location and Maps Programming Guide http://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/LocationAwarenessPG/Introduction/Introduction.html

Apple Developer Forums http://devforums.apple.com

Page 255: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Related Sessions

• Introducing the Modern WebKit API Nob Hill Tuesday 2:00PM

• Taking Core Location Indoors Marina Tuesday 3:15PM

• Writing Energy Efficient Code, Part 2 Russian Hill Wednesday 11:30AM

• What’s New in iOS Notifications Nob Hill Wednesday 2:00PM

• User Privacy in iOS and OS X Nob Hill Thursday 2:00PM

Page 256: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location

Labs

• Core Location Lab Core OS Lab B Thursday 12:45PM

Page 257: What’s New in Core Location - Apple Developer · What’s New in Core Location Location authorization Visit monitoring Indoor positioning. Introduction A brief history. ... Location