increase usage of your app with proactive suggestions...proactive suggestions to learn when to...

234
© 2016 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. App Frameworks #WWDC16 Session 240 Increase Usage of Your App with Proactive Suggestions Daniel Gross Siri Sofiane Toudji Software Engineering

Upload: others

Post on 13-Jul-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

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

App Frameworks #WWDC16

Session 240

Increase Usage of Your Appwith Proactive Suggestions

Daniel Gross SiriSofiane Toudji Software Engineering

Page 2: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

You want more users.

Page 3: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

You want more users.

Apple wants to offer your app at the right moment.

Page 4: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Siri App Suggestions

Page 5: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Siri App Suggestions

Page 6: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Spotlight Search

Page 7: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Handoff

Page 8: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Now Playing

Page 9: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Contextual Siri Reminders

Page 10: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Contextual Siri Reminders

Page 11: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

QuickType

Page 12: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Multitasking

Page 13: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Contact Interactions

Page 14: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewProactive Suggestions

Page 15: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewProactive Suggestions

To learn when to promote you, the OS needs to know more about your data or app

Page 16: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewProactive Suggestions

To learn when to promote you, the OS needs to know more about your data or appA few simple APIs deeply integrate your app into iOS and macOS

Page 17: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewProactive Suggestions

To learn when to promote you, the OS needs to know more about your data or appA few simple APIs deeply integrate your app into iOS and macOSDeeper integration with Siri “for free”

Page 18: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

AgendaProactive Suggestions

Page 19: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

AgendaProactive Suggestions

NSUserActivity and schema.org

Page 20: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions

AgendaProactive Suggestions

NSUserActivity and schema.org

Page 21: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions

Media App Suggestions

AgendaProactive Suggestions

NSUserActivity and schema.org

Page 22: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions

Media App Suggestions

Summary

AgendaProactive Suggestions

NSUserActivity and schema.org

Page 23: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

AgendaProactive Suggestions

Location Suggestions

Media App Suggestions

Summary

NSUserActivity and schema.org

Page 24: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Handoff1

Spotlight Search2

Contextual Siri Reminders3

Location Suggestions4

Contextual Siri Requests5

Contact Interactions6

Page 25: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

NSUserActivity

Page 26: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

HandoffNSUserActivity

Page 27: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

HandoffNSUserActivity

Page 28: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Spotlight Search

Page 29: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions

NEW

Page 30: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions

NEW

Page 31: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Contextual Siri Requests

NEW

Page 32: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Contact Interactions

NEW

Page 33: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Contact Interactions

NEW

Page 34: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

How does it work?

Page 35: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

NSUserActivityNative apps

schema.orgWeb apps

Page 36: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

NSUserActivityNative apps

schema.orgWeb apps

Page 37: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Capturing app stateNSUserActivity

Page 38: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Capturing app stateNSUserActivity

NSUserActivity

Page 39: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Capturing app stateNSUserActivity

NSUserActivity

Page 40: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Capturing app stateNSUserActivity

NSUserActivity NSUserActivity

Page 41: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Capturing app stateNSUserActivity

NSUserActivity NSUserActivity

Page 42: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Capturing app stateNSUserActivity

NSUserActivity NSUserActivity NSUserActivity

Page 43: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

NSUserActivity

Page 44: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

NSUserActivity

Payload Metadata

NSUserActivity

Page 45: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

NSUserActivity

Payload Metadata

NSUserActivity

Advertised for Handoff

Page 46: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

NSUserActivity

Payload Metadata

NSUserActivity

Advertised for Handoff

Temporary Context

Page 47: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

NSUserActivity

Payload Metadata

NSUserActivity

Advertised for Handoff

Temporary Context

ItemSpotlight on Device Index

Page 48: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Related Sessions

Making the Most of Search APIs Pacific Heights Thursday 11:00AM

Adopting Handoff on iOS and OS X WWDC 2014

Introducing Search APIs WWDC 2015

Page 49: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Creating Activities

Page 50: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Creating Activities

let activity = NSUserActivity(activityType: "com.example.view-location") activity.title = "Yank Sing"

Create user activity object

Page 51: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Creating Activities

let activity = NSUserActivity(activityType: "com.example.view-location") activity.title = "Yank Sing"

Create user activity object

activity.isEligibleForHandoff = true activity.isEligibleForSearch = true activity.isEligibleForPublicIndexing = true

Enable capabilities

Page 52: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

activity.userInfo = ["id": "yank-sing-san-francisco"]

Specify userInfo

Creating Activities

let activity = NSUserActivity(activityType: "com.example.view-location") activity.title = "Yank Sing"

Create user activity object

activity.isEligibleForHandoff = true activity.isEligibleForSearch = true activity.isEligibleForPublicIndexing = true

Enable capabilities

Page 53: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Creating Activities

let attributes = CSSearchableItemAttributeSet(itemContentType: "com.example.location") // Provide values for all relevant attributes attributes.thumbnailURL = myThumbnailURL activity.keywords = ["dim sum", "cantonese", "restaurant"] activity.contentAttributeSet = attributes

Provide metadata

Page 54: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Creating Activities

activity.webpageURL = "http://www.example.com/yank-sing-san-francisco"

Restoring on the web

let attributes = CSSearchableItemAttributeSet(itemContentType: "com.example.location") // Provide values for all relevant attributes attributes.thumbnailURL = myThumbnailURL activity.keywords = ["dim sum", "cantonese", "restaurant"] activity.contentAttributeSet = attributes

Provide metadata

Page 55: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Creating Activities

activity.becomeCurrent()

activity.webpageURL = "http://www.example.com/yank-sing-san-francisco"

Restoring on the web

let attributes = CSSearchableItemAttributeSet(itemContentType: "com.example.location") // Provide values for all relevant attributes attributes.thumbnailURL = myThumbnailURL activity.keywords = ["dim sum", "cantonese", "restaurant"] activity.contentAttributeSet = attributes

Provide metadata

Page 56: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

UIApplicationDelegateContinuing Activities

func application(UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: [AnyObject]? -> Void) -> Bool {

if userActivity.activityType == "com.example.view-location" {

// Restore state for userActivity and userInfo

} return true }

Page 57: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

UIApplicationDelegateContinuing Activities

func application(UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: [AnyObject]? -> Void) -> Bool {

if userActivity.activityType == "com.example.view-location" {

// Restore state for userActivity and userInfo

} return true }

Page 58: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

UIApplicationDelegateContinuing Activities

func application(UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: [AnyObject]? -> Void) -> Bool {

if userActivity.activityType == "com.example.view-location" {

// Restore state for userActivity and userInfo

} return true }

Page 59: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

5

4 Location Suggestions

Contextual Siri Requests

Contact Interactions6

Handoff1

Spotlight Search2

Contextual Siri Reminders3

Page 60: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

5

4 Location Suggestions

Contextual Siri Requests

Location Suggestions

Contextual Siri Requests

4

5

Contact Interactions6

Handoff1

Spotlight Search2

Contextual Siri Reminders3

Page 61: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Find a Place to Eat

Steps

1

Page 62: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Text Friends

Steps

123

Find a Place to Eat*Switch App*

Page 63: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Copy Address

Steps

123

Find a Place to Eat Text Friends*Switch App*

*Switch App*

45

Page 64: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Paste Address

Steps

123

Find a Place to Eat Text Friends

Copy Address

*Switch App*

*Switch App*

*Switch App*

4567

Page 65: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Get Directions

Steps

123

Find a Place to Eat Text Friends

Copy Address

Paste AddressGet Directions

*Switch App*

*Switch App*

*Switch App* *Switch App*

456789

Page 66: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Get Directions

Steps

123

Find a Place to Eat Text Friends

Copy Address

Paste AddressGet Directions

*Switch App*

*Switch App*

*Switch App* *Switch App*

456789

Page 67: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 68: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 69: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 70: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 71: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 72: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 73: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 74: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

From Yelp

Page 75: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

From Your App

Page 76: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

BackgroundLocation Suggestions

Capture locations viewed by the userMapKit and CoreSpotlight APIsIntegrate with Siri, Maps, Keyboards, Multitasking, and more

NEW

Page 77: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

MapKit-based appsLocation Suggestions

let activity = NSUserActivity(activityType: "com.example.view-location")

Reuse the same user activity

NEW

Page 78: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

MapKit-based appsLocation Suggestions

let activity = NSUserActivity(activityType: "com.example.view-location")

Reuse the same user activity

activity.mapItem = myMapItem

Set MKMapItem

NEW

Page 79: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Apps adopting app searchLocation Suggestions

let attributes = CSSearchableItemAttributeSet(itemContentType: "location") attributes.namedLocation = "Apple Inc." attributes.subThoroughfare = "1" attributes.thoroughfare = "Infinite Loop" attributes.city = "Cupertino" attributes.stateOrProvince = "CA" attributes.country = "United States” attributes.latitude = 37.33072 attributes.longitude = -122.029674 attributes.phoneNumbers = ["(800) 275-2273"] attributes.supportsPhoneCall = true attributes.supportsNavigation = true

NEW

Page 80: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Apps adopting app searchLocation Suggestions

let attributes = CSSearchableItemAttributeSet(itemContentType: "location") attributes.namedLocation = "Apple Inc." attributes.subThoroughfare = "1" attributes.thoroughfare = "Infinite Loop" attributes.city = "Cupertino" attributes.stateOrProvince = "CA" attributes.country = "United States” attributes.latitude = 37.33072 attributes.longitude = -122.029674 attributes.phoneNumbers = ["(800) 275-2273"] attributes.supportsPhoneCall = true attributes.supportsNavigation = true

NEW

Page 81: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Apps adopting app searchLocation Suggestions

let attributes = CSSearchableItemAttributeSet(itemContentType: "location") attributes.namedLocation = "Apple Inc." attributes.subThoroughfare = "1" attributes.thoroughfare = "Infinite Loop" attributes.city = "Cupertino" attributes.stateOrProvince = "CA" attributes.country = "United States” attributes.latitude = 37.33072 attributes.longitude = -122.029674 attributes.phoneNumbers = ["(800) 275-2273"] attributes.supportsPhoneCall = true attributes.supportsNavigation = true

NEW

Page 82: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Apps adopting app searchLocation Suggestions

let attributes = CSSearchableItemAttributeSet(itemContentType: "location") attributes.namedLocation = "Apple Inc." attributes.subThoroughfare = "1" attributes.thoroughfare = "Infinite Loop" attributes.city = "Cupertino" attributes.stateOrProvince = "CA" attributes.country = "United States” attributes.latitude = 37.33072 attributes.longitude = -122.029674 attributes.phoneNumbers = ["(800) 275-2273"] attributes.supportsPhoneCall = true attributes.supportsNavigation = true

NEW

Page 83: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Apps adopting app searchLocation Suggestions

let attributes = CSSearchableItemAttributeSet(itemContentType: "location") attributes.namedLocation = "Apple Inc." attributes.subThoroughfare = "1" attributes.thoroughfare = "Infinite Loop" attributes.city = "Cupertino" attributes.stateOrProvince = "CA" attributes.country = "United States” attributes.latitude = 37.33072 attributes.longitude = -122.029674 attributes.phoneNumbers = ["(800) 275-2273"] attributes.supportsPhoneCall = true attributes.supportsNavigation = true

NEW

Page 84: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Apps adopting app searchLocation Suggestions

let attributes = CSSearchableItemAttributeSet(itemContentType: "location") attributes.namedLocation = "Apple Inc." attributes.subThoroughfare = "1" attributes.thoroughfare = "Infinite Loop" attributes.city = "Cupertino" attributes.stateOrProvince = "CA" attributes.country = "United States” attributes.latitude = 37.33072 attributes.longitude = -122.029674 attributes.phoneNumbers = ["(800) 275-2273"] attributes.supportsPhoneCall = true attributes.supportsNavigation = true

NEW

Page 85: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions4

Contextual Siri Requests5

Contact interactions6

Spotlight Search

Handoff

Contextual Siri Reminders

Page 86: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions4

Contextual Siri Requests5

Contact interactions6

Spotlight Search

Handoff

Contextual Siri Reminders

Contact Interactions6

Page 87: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 88: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 89: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 90: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 91: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 92: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 93: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

NSUserActivity + Intents

Introducing SiriKit Presidio Wednesday 5:00PM

Extending Your Apps with SiriKit Presidio Thursday 1:40PM

Page 94: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Donating interactionsContact Interactions NEW

Page 95: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Donating interactionsContact Interactions NEW

INIntent Participants Metadata

INInteraction

Page 96: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Donating interactionsContact Interactions NEW

Contact Card

INIntent Participants Metadata

INInteraction

Page 97: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Donating interactionsContact Interactions NEW

Contact Card

NSUserActivity

INIntent Participants Metadata

INInteraction

Page 98: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Donating interactionsContact Interactions

Specify sender and recipient

let sender = INPerson(handle: "[email protected]", displayName: "John Appleseed", contactIdentifier: nil)

let recipient = INPerson(handle: "[email protected]", displayName: "Jane Daniels", contactIdentifier: nil)

NEW

Page 99: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Create an intent

Donating interactionsContact Interactions NEW

let intent = INSendMessageIntent(recipients: [recipient], content: nil serviceName: INMessageServiceNameWhatsApp sender: sender)

Page 100: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Create an intent

Donating interactionsContact Interactions NEW

let intent = INSendMessageIntent(recipients: [recipient], content: nil serviceName: INMessageServiceNameWhatsApp sender: sender)

Page 101: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Create an intent

Donating interactionsContact Interactions

Three communication intents

• INSendMessageIntent

• INStartAudioCallIntent

• INStartVideoCallIntent

NEW

let intent = INSendMessageIntent(recipients: [recipient], content: nil serviceName: INMessageServiceNameWhatsApp sender: sender)

Page 102: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Create an intent

Donating interactionsContact Interactions

Three communication intents

• INSendMessageIntent

• INStartAudioCallIntent

• INStartVideoCallIntent

NEW

let intent = INSendMessageIntent(recipients: [recipient], content: nil serviceName: INMessageServiceNameWhatsApp sender: sender)

Page 103: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Donating interactionsContact Interactions

Create an interaction

let interaction = INInteraction(intent: intent, response: INIntent.responseSuccess)

interaction.direction = INInteractionDirectionOutgoing interaction.intentHandlingStatus = INIntentHandlingStatusDone

NEW

Page 104: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Donating interactionsContact Interactions

Create an interaction

let interaction = INInteraction(intent: intent, response: INIntent.responseSuccess)

interaction.direction = INInteractionDirectionOutgoing interaction.intentHandlingStatus = INIntentHandlingStatusDone

NEW

Page 105: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Donating interactionsContact Interactions

Create an interaction

let interaction = INInteraction(intent: intent, response: INIntent.responseSuccess)

interaction.direction = INInteractionDirectionOutgoing interaction.intentHandlingStatus = INIntentHandlingStatusDone

NEW

interaction.donateInteraction(completion: { (error) in // Interaction donated })

Donate interaction

Page 106: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

UIApplicationDelegateHandling Communication

func application(UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: [AnyObject]? -> Void) -> Bool {

if let intent = userActivity.interaction?.intent as? INSendMessageIntent { // Start communication with recipient } return true }

Page 107: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

UIApplicationDelegateHandling Communication

func application(UIApplication, continueUserActivity userActivity: NSUserActivity, restorationHandler: [AnyObject]? -> Void) -> Bool {

if let intent = userActivity.interaction?.intent as? INSendMessageIntent { // Start communication with recipient } return true }

Page 108: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions

Contextual Siri Requests

Contact Interactions6

Spotlight Search

Handoff

Contextual Siri Reminders

Page 109: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions

Contextual Siri Requests

Contact Interactions6

Spotlight Search

Handoff

Contextual Siri Reminders

Page 110: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Best Practices

Page 111: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Lazy payload updateBest Practices

Use needsSave for lazy payload updates

func updateActivityForEachKeystroke() { activity.userInfo = ["textContent": textfield.text]}

Page 112: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Lazy payload updateBest Practices

Use needsSave for lazy payload updates

func updateActivityForEachKeystroke() { activity.userInfo = ["textContent": textfield.text]}

Page 113: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Lazy payload updateBest Practices

Use needsSave for lazy payload updates

func updateActivityForEachKeystroke() { activity.userInfo = ["textContent": textfield.text]}

func updateActivityForEachKeystroke() { activity.needsSave = true }

override func updateUserActivityState(_ activity: NSUserActivity) { activity.addUserInfoEntries(from: ["textContent": textfield.text]) }

Page 114: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Scope of current activityBest Practices

Keep a strong reference to the current activity

func updateActivity() { let activity = NSUserActivity(activityType: "com.example.my-activity") // setup user activity activity.becomeCurrent() }

// activity is released

Page 115: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Scope of current activityBest Practices

Keep a strong reference to the current activity

func updateActivity() { let activity = NSUserActivity(activityType: "com.example.my-activity") // setup user activity activity.becomeCurrent() }

// activity is released

Page 116: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Scope of current activityBest Practices

Keep a strong reference to the current activity

func updateActivity() { let activity = NSUserActivity(activityType: "com.example.my-activity") // setup user activity self.userActivity = activity activity.becomeCurrent() }

Page 117: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Scope of current activityBest Practices

Keep a strong reference to the current activity

func updateActivity() { let activity = NSUserActivity(activityType: "com.example.my-activity") // setup user activity self.userActivity = activity activity.becomeCurrent() }

Page 118: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Transfer a small userInfo payloadBest Practices

Transfer a small payload in the userInfo dictionary

let imageData: Data // Downloaded image data from a web service let photo = UIImage(data: imageData)

activity.userInfo = ["photoData": imageData]

Page 119: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Transfer a small userInfo payloadBest Practices

Transfer a small payload in the userInfo dictionary

let imageData: Data // Downloaded image data from a web service let photo = UIImage(data: imageData)

activity.userInfo = ["photoData": imageData]

Page 120: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Transfer a small userInfo payloadBest Practices

Transfer a small payload in the userInfo dictionary

let imageData: Data // Downloaded image data from a web service let photo = UIImage(data: imageData)

activity.userInfo = ["photoData": imageData]

activity.userInfo = ["photoRemoteURL": imageRemoteURL]

Page 121: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Unique activity typesBest Practices

Use reverse-DNS notation for your activity types

let activity = NSUserActivity(activityType: "my-activity")

Page 122: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Unique activity typesBest Practices

Use reverse-DNS notation for your activity types

let activity = NSUserActivity(activityType: "my-activity")

Page 123: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Unique activity typesBest Practices

Use reverse-DNS notation for your activity types

let activity = NSUserActivity(activityType: "my-activity")

let activity = NSUserActivity(activityType: "com.example.view-location") let activity = NSUserActivity(activityType: "com.example.search-location")

Page 124: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

DemoProactive Toolbox app

Page 125: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

NSUserActivityNative apps

schema.orgWeb apps

Page 126: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 127: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 128: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 129: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Backgroundschema.org

Open web markup vocabulary standardStructured metadata on web pages500+ schemas representing various conceptsSome of the benefits of NSUserActivity for the web

Page 130: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Structureschema.org

Thing

… ……

… AggregateRating

…Rating

Organization

LocalBusiness

Restaurant

Page 131: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Structureschema.org

Thing

… ……

… AggregateRating

…Rating

Organization

LocalBusiness

Restaurant

Page 132: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Structureschema.org

Thing

… ……

… AggregateRating

…Rating

Organization

LocalBusiness

Restaurant

Page 133: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Example—Restaurantschema.org

ThingOrganization

LocalBusinessPlace

RestaurantFoodEstablishment

Property Type Defined in Schemaname Text Thing

aggregateRating AggregateRating Organizationaddress PostalAddress LocalBusiness

telephone Text LocalBusinessopeningHours Text FoodEstablishment

priceRange Text FoodEstablishmentacceptsReservations Boolean Restaurant

Page 134: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Web apps promoting locationsschema.org

<script type="application/ld+json"> { "@context": "http://schema.org", "@type": "Restaurant", "name": "Yank Sing", "telephone": "(415) 781-1111", "url": "http://www.yanksing.com", "address": { "@type": "PostalAddress", "streetAddress": "101 Spear St", "addressLocality": "San Francisco", "postalCode": "94105", "addressRegion": "CA" }, "aggregateRating": { "@type": "AggregateRating", "ratingValue": "3.5", "reviewCount": "2022" } } </script>

NEW

Page 135: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

<!-- Restaurant web page without markups --> <div> Yank Sing<br/> 3.5 stars - based on 2022 reviews<br/> 101 Spear St, San Francisco, CA 94105<br/> (408) 714-1489<br/> <a href="http://www.yanksing.com">www.yanksing.com</a> </div>

Page 136: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

<!-- Restaurant web page without markups --> <div> Yank Sing<br/> 3.5 stars - based on 2022 reviews<br/> 101 Spear St, San Francisco, CA 94105<br/> (408) 714-1489<br/> <a href="http://www.yanksing.com">www.yanksing.com</a> </div>

markups -->

Page 137: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

<!-- Restaurant web page without markups --> <div> Yank Sing<br/> 3.5 stars - based on 2022 reviews<br/> 101 Spear St, San Francisco, CA 94105<br/> (408) 714-1489<br/> <a href="http://www.yanksing.com">www.yanksing.com</a> </div>

markups --> JSON-LD

<script type="application/ld+json"> { "@context": "http://schema.org", "@type": "Restaurant", "name": "Yank Sing", "telephone": "(415) 781-1111", "url": "http://www.yanksing.com", "address": { "@type": "PostalAddress", "streetAddress": "101 Spear St", "addressLocality": "San Francisco", "postalCode": "94105", "addressRegion": "CA" }, "aggregateRating": { "@type": "AggregateRating", "ratingValue": "3.5", "reviewCount": "2022" }} </script>

Page 138: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

<!-- Restaurant web page without markups --> <div> Yank Sing<br/> 3.5 stars - based on 2022 reviews<br/> 101 Spear St, San Francisco, CA 94105<br/> (408) 714-1489<br/> <a href="http://www.yanksing.com">www.yanksing.com</a> </div>

markups --> JSON-LD

<script type="application/ld+json"> { "@context": "http://schema.org", "@type": "Restaurant", "name": "Yank Sing", "telephone": "(415) 781-1111", "url": "http://www.yanksing.com", "address": { "@type": "PostalAddress", "streetAddress": "101 Spear St", "addressLocality": "San Francisco", "postalCode": "94105", "addressRegion": "CA" }, "aggregateRating": { "@type": "AggregateRating", "ratingValue": "3.5", "reviewCount": "2022" }} </script>

Page 139: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

<!-- Restaurant web page without markups --> <div> Yank Sing<br/> 3.5 stars - based on 2022 reviews<br/> 101 Spear St, San Francisco, CA 94105<br/> (408) 714-1489<br/> <a href="http://www.yanksing.com">www.yanksing.com</a> </div>

markups --> JSON-LD

<script type="application/ld+json"> { "@context": "http://schema.org", "@type": "Restaurant", "name": "Yank Sing", "telephone": "(415) 781-1111", "url": "http://www.yanksing.com", "address": { "@type": "PostalAddress", "streetAddress": "101 Spear St", "addressLocality": "San Francisco", "postalCode": "94105", "addressRegion": "CA" }, "aggregateRating": { "@type": "AggregateRating", "ratingValue": "3.5", "reviewCount": "2022" }} </script>

Page 140: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

<!-- Restaurant web page with inline microdata markups --><div itemscope itemtype="http://schema.org/Restaurant"> <span itemprop="name">Yank Sing</span> <div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating"> <span itemprop="ratingValue">3.5</span> stars - based on <span itemprop="reviewCount">2022</span> reviews </div> <div itemprop="address" itemscope itemtype="http://schema.org/PostalAddress"> <span itemprop="streetAddress">101 Spear St</span> <span itemprop="addressLocality">San Francisco</span>, <span itemprop="addressRegion">CA</span> <span itemprop="postalCode">94105</span> </div> <span itemprop="telephone">(415) 781-1111</span> <a itemprop="url" href="http://www.yanksing.com">www.yanksing.com</a> </div>

Page 141: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Web apps promoting locationsschema.org

Safari relies on location-related schemas for location suggestionsSome of the benefits of NSUserActivity for the webSupport for JSON-LD and Microdata

NEW

Page 142: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Supported schemasschema.org

Any schemas with:• PostalAddress• GeoCoordinates• A telephone property

NEW

Page 143: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Summary

NSUserActivityNative apps

schema.orgWeb apps

Page 144: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Summary

NSUserActivityNative apps

schema.orgWeb apps

Promote locationsContact interactions

Spotlight Search and Handoff

Page 145: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Summary

NSUserActivityNative apps

schema.orgWeb apps

Promote locationsContact interactions

Spotlight Search and Handoff

Promote locations on the web

Page 146: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions

Media App Suggestions

Summary

NSUserActivity and schema.org

Page 147: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions in QuickType1

Routing Apps2

Page 148: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions in QuickType1

Routing Apps2

Page 149: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

647 x 1150

NEW

Page 150: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

647 x 1150

NEW

Page 151: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

647 x 1150

NEW

Page 152: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

647 x 1150

NEW

Page 153: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

647 x 1150

NEW

Page 154: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

647 x 1150

NEW

Page 155: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

QuickTypeLocations Suggestions

Hint the semantic intent for eligible text containersGet proactive suggestions in your appBenefit from enhanced autocorrection

NEW

Page 156: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Text content typeUITextInputTraits

New UITextInputTraits textContentType API

let textField = UITextField() textField.textContentType = UITextContentTypeFullStreetAddress

NEW

Page 157: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Text content typeUITextInputTraits NEW

UITextContentTypeName

UITextContentTypeGivenName

UITextContentTypeFamilyName

UITextContentTypeLocation

UITextContentTypeFullStreetAddress

UITextContentTypeAddressCityAndState

UITextContentTypeTelephoneNumber

UITextContentTypeEmailAddress

Page 158: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Text content typeUITextInputTraits NEW

UITextContentTypeName

UITextContentTypeGivenName

UITextContentTypeFamilyName

UITextContentTypeLocation

UITextContentTypeFullStreetAddress

UITextContentTypeAddressCityAndState

UITextContentTypeTelephoneNumber

UITextContentTypeEmailAddress

Page 159: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Text content typeUITextInputTraits

UITextContentTypeName

UITextContentTypeGivenName

UITextContentTypeFamilyName

UITextContentTypeLocation

NEW

UITextContentTypeFullStreetAddress

UITextContentTypeAddressCityAndState

UITextContentTypeTelephoneNumber

UITextContentTypeEmailAddress

Page 160: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Text content typeUITextInputTraits

UITextContentTypeName

UITextContentTypeGivenName

UITextContentTypeFamilyName

UITextContentTypeLocation

NEW

UITextContentTypeFullStreetAddress

UITextContentTypeAddressCityAndState

UITextContentTypeTelephoneNumber

UITextContentTypeEmailAddress

Page 161: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

But let’s take a look at 2 more closely. UITextContentTypeFullStreetAddress

UITextContentTypeCityAndState

Page 162: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

GranularityLocation Suggestions

UITextContentTypeFullStreetAddress

NEW

Page 163: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

GranularityLocation Suggestions

UITextContentTypeFullStreetAddress

NEW

Page 164: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

GranularityLocation Suggestions

UITextContentTypeAddressCityAndStateUITextContentTypeFullStreetAddress

NEW

Page 165: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

2 Routing Apps

Location Suggestions in QuickType1

Page 166: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Routing Apps2

Location Suggestions in QuickType1

Page 167: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 168: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location
Page 169: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

For routing appsConsuming Locations

Promote your app in MultitaskingRegister as a routing appHandle launch with MapKit’s MKDirectionsRequestiOS learns to suggest your app based on user engagement

NEW

Page 170: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewMKDirectionsRequest

Page 171: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewMKDirectionsRequest

Configure your app to accept directions requests in Xcode

Page 172: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewMKDirectionsRequest

Configure your app to accept directions requests in XcodeDeclare the map regions thatyour app supports

Page 173: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewMKDirectionsRequest

Configure your app to accept directions requests in XcodeDeclare the map regions thatyour app supportsProcess direction request URLswhen they are sent to your app

Page 174: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

// Handle launch with MKDirectionsRequest func application(app: UIApplication,

url: NSURL,

options: [String : AnyObject]) -> Bool {

if (MKDirectionsRequest.isDirectionsRequestURL(url)) {

let directionsRequest = MKDirectionsRequest(contentsOfURL: url)

// Handle routing request

guard

let coordinate = directionsRequest.destination?.placemark.location?.coordinate,

let addressDictionary = directionsRequest.destination?.placemark.addressDictionary

where !CLLocationCoordinate2DIsValid(coordinate)

else { return true }

let geocoder = CLGeocoder()

geocoder.geocodeAddressDictionary(addressDictionary, completionHandler: { (place, err) in

// Handle launch

})

}

return true

}

NEW

Page 175: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

// Handle launch with MKDirectionsRequest func application(app: UIApplication,

url: NSURL,

options: [String : AnyObject]) -> Bool {

if (MKDirectionsRequest.isDirectionsRequestURL(url)) {

let directionsRequest = MKDirectionsRequest(contentsOfURL: url)

// Handle routing request

guard

let coordinate = directionsRequest.destination?.placemark.location?.coordinate,

let addressDictionary = directionsRequest.destination?.placemark.addressDictionary

where !CLLocationCoordinate2DIsValid(coordinate)

else { return true }

let geocoder = CLGeocoder()

geocoder.geocodeAddressDictionary(addressDictionary, completionHandler: { (place, err) in

// Handle launch

})

}

return true

}

NEW

Page 176: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

// Handle launch with MKDirectionsRequest func application(app: UIApplication,

url: NSURL,

options: [String : AnyObject]) -> Bool {

if (MKDirectionsRequest.isDirectionsRequestURL(url)) {

let directionsRequest = MKDirectionsRequest(contentsOfURL: url)

// Handle routing request

guard

let coordinate = directionsRequest.destination?.placemark.location?.coordinate,

let addressDictionary = directionsRequest.destination?.placemark.addressDictionary

where !CLLocationCoordinate2DIsValid(coordinate)

else { return true }

let geocoder = CLGeocoder()

geocoder.geocodeAddressDictionary(addressDictionary, completionHandler: { (place, err) in

// Handle launch

})

}

return true

}

NEW

Page 177: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

// Handle launch with MKDirectionsRequest func application(app: UIApplication,

url: NSURL,

options: [String : AnyObject]) -> Bool {

if (MKDirectionsRequest.isDirectionsRequestURL(url)) {

let directionsRequest = MKDirectionsRequest(contentsOfURL: url)

// Handle routing request

guard

let coordinate = directionsRequest.destination?.placemark.location?.coordinate,

let addressDictionary = directionsRequest.destination?.placemark.addressDictionary

where !CLLocationCoordinate2DIsValid(coordinate)

else { return true }

let geocoder = CLGeocoder()

geocoder.geocodeAddressDictionary(addressDictionary, completionHandler: { (place, err) in

// Handle launch

})

}

return true

}

NEW

Page 178: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions in QuickType1

Routing Apps2

Page 179: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions in QuickType1

Routing Apps2

Page 180: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions

Media App Suggestions

Summary

NSUserActivity and schema.org

Page 181: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewPromoting Your Media App

Page 182: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewPromoting Your Media App

iOS promotes the app a user is likely to use based on behavior

Page 183: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewPromoting Your Media App

iOS promotes the app a user is likely to use based on behaviorSuggestions are offered in Spotlight and Today View

Page 184: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewPromoting Your Media App

iOS promotes the app a user is likely to use based on behaviorSuggestions are offered in Spotlight and Today View If they follow a particular trigger, suggestions may be elevated to the lock screen

Page 185: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewPromoting Your Media App

iOS promotes the app a user is likely to use based on behaviorSuggestions are offered in Spotlight and Today View If they follow a particular trigger, suggestions may be elevated to the lock screenFor example:• After plugging in headphones or a BT device (Podcasts, Music)• After getting in a car (Maps)• After arriving at home or work (Agenda app)

Page 186: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Spotlight

Page 187: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Spotlight

Page 188: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Lockscreen

Page 189: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

With a simple API, you can build a far more engaging lock screen experience.

Page 190: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Before

Page 191: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

After

Page 192: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Before

Page 193: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

After

Page 194: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Increase in conversion

10X

Page 195: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

How?

Page 196: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

MPPlayableContentManager

Page 197: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

struct MediaItem {

var title: String

var artist: String

var album: String

var duration: Double

var albumArtwork: UIImage

var albumArtworkSize: CGSize

}

Page 198: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

import MediaPlayer

class MyPlayer: MPPlayableContentDelegate, NSObject {

override init() {

super.init()

MPPlayableContentManager.shared().delegate = self

}

}

Page 199: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

import MediaPlayer

class MyPlayer: MPPlayableContentDelegate, NSObject {

override init() {

super.init()

MPPlayableContentManager.shared().delegate = self

}

}

Page 200: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

import MediaPlayer

class MyPlayer: MPPlayableContentDelegate, NSObject {

override init() {

super.init()

MPPlayableContentManager.shared().delegate = self

}

}

Page 201: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

import MediaPlayer

class MyPlayer: MPPlayableContentDelegate, NSObject {

override init() {

super.init()

MPPlayableContentManager.shared().delegate = self

}

}

Page 202: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func playableContentManager(contentManager: MPPlayableContentManager,

initializePlaybackQueueWithContentItems contentItems: [AnyObject]?,

completionHandler: (NSError?) -> Void) {

guard let mediaItem = findMediaItemToPlay() else {

// Handle error, call completion handler with error and return

}

populateNowPlayingInfo(mediaItem: mediaItem)

guard let status = preparePlayback(mediaItem: mediaItem) else {

// Handle error, call completion handler with error and return

}

// Do other things that are required for success

completionHandler(nil)

}

Page 203: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func playableContentManager(contentManager: MPPlayableContentManager,

initializePlaybackQueueWithContentItems contentItems: [AnyObject]?,

completionHandler: (NSError?) -> Void) {

guard let mediaItem = findMediaItemToPlay() else {

// Handle error, call completion handler with error and return

}

populateNowPlayingInfo(mediaItem: mediaItem)

guard let status = preparePlayback(mediaItem: mediaItem) else {

// Handle error, call completion handler with error and return

}

// Do other things that are required for success

completionHandler(nil)

}

Page 204: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func playableContentManager(contentManager: MPPlayableContentManager,

initializePlaybackQueueWithContentItems contentItems: [AnyObject]?,

completionHandler: (NSError?) -> Void) {

guard let mediaItem = findMediaItemToPlay() else {

// Handle error, call completion handler with error and return

}

populateNowPlayingInfo(mediaItem: mediaItem)

guard let status = preparePlayback(mediaItem: mediaItem) else {

// Handle error, call completion handler with error and return

}

// Do other things that are required for success

completionHandler(nil)

}

Page 205: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func playableContentManager(contentManager: MPPlayableContentManager,

initializePlaybackQueueWithContentItems contentItems: [AnyObject]?,

completionHandler: (NSError?) -> Void) {

guard let mediaItem = findMediaItemToPlay() else {

// Handle error, call completion handler with error and return

}

populateNowPlayingInfo(mediaItem: mediaItem)

guard let status = preparePlayback(mediaItem: mediaItem) else {

// Handle error, call completion handler with error and return

}

// Do other things that are required for success

completionHandler(nil)

}

Page 206: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func playableContentManager(contentManager: MPPlayableContentManager,

initializePlaybackQueueWithContentItems contentItems: [AnyObject]?,

completionHandler: (NSError?) -> Void) {

guard let mediaItem = findMediaItemToPlay() else {

// Handle error, call completion handler with error and return

}

populateNowPlayingInfo(mediaItem: mediaItem)

guard let status = preparePlayback(mediaItem: mediaItem) else {

// Handle error, call completion handler with error and return

}

// Do other things that are required for success

completionHandler(nil)

}

Page 207: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func playableContentManager(contentManager: MPPlayableContentManager,

initializePlaybackQueueWithContentItems contentItems: [AnyObject]?,

completionHandler: (NSError?) -> Void) {

guard let mediaItem = findMediaItemToPlay() else {

// Handle error, call completion handler with error and return

}

populateNowPlayingInfo(mediaItem: mediaItem)

guard let status = preparePlayback(mediaItem: mediaItem) else {

// Handle error, call completion handler with error and return

}

// Do other things that are required for success

completionHandler(nil)

}

Page 208: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func populateNowPlayingInfo(item: MediaItem) {

let infoCenter = MPNowPlayingInfoCenter.defaultCenter()

if let image = item.albumArtwork ?? UIImage(named: "EmptyAlbum") {

let albumArt = MPMediaItemArtwork(boundsSize: item.albumArtworkSize, requestHandler: { (size) -> UIImage in

return image

})

let nowPlayingInfo = [

MPMediaItemPropertyTitle: item.title,

MPMediaItemPropertyArtist: item.artist,

MPMediaItemPropertyAlbumTitle: item.album,

MPMediaItemPropertyPlaybackDuration: item.duration,

MPMediaItemPropertyArtwork: albumArt

]

infoCenter.nowPlayingInfo = nowPlayingInfo

}

}

Page 209: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func populateNowPlayingInfo(item: MediaItem) {

let infoCenter = MPNowPlayingInfoCenter.defaultCenter()

if let image = item.albumArtwork ?? UIImage(named: "EmptyAlbum") {

let albumArt = MPMediaItemArtwork(boundsSize: item.albumArtworkSize, requestHandler: { (size) -> UIImage in

return image

})

let nowPlayingInfo = [

MPMediaItemPropertyTitle: item.title,

MPMediaItemPropertyArtist: item.artist,

MPMediaItemPropertyAlbumTitle: item.album,

MPMediaItemPropertyPlaybackDuration: item.duration,

MPMediaItemPropertyArtwork: albumArt

]

infoCenter.nowPlayingInfo = nowPlayingInfo

}

}

Page 210: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func populateNowPlayingInfo(item: MediaItem) {

let infoCenter = MPNowPlayingInfoCenter.defaultCenter()

if let image = item.albumArtwork ?? UIImage(named: "EmptyAlbum") {

let albumArt = MPMediaItemArtwork(boundsSize: item.albumArtworkSize, requestHandler: { (size) -> UIImage in

return image

})

let nowPlayingInfo = [

MPMediaItemPropertyTitle: item.title,

MPMediaItemPropertyArtist: item.artist,

MPMediaItemPropertyAlbumTitle: item.album,

MPMediaItemPropertyPlaybackDuration: item.duration,

MPMediaItemPropertyArtwork: albumArt

]

infoCenter.nowPlayingInfo = nowPlayingInfo

}

}

Page 211: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func populateNowPlayingInfo(item: MediaItem) {

let infoCenter = MPNowPlayingInfoCenter.defaultCenter()

if let image = item.albumArtwork ?? UIImage(named: "EmptyAlbum") {

let albumArt = MPMediaItemArtwork(boundsSize: item.albumArtworkSize, requestHandler: { (size) -> UIImage in

return image

})

let nowPlayingInfo = [

MPMediaItemPropertyTitle: item.title,

MPMediaItemPropertyArtist: item.artist,

MPMediaItemPropertyAlbumTitle: item.album,

MPMediaItemPropertyPlaybackDuration: item.duration,

MPMediaItemPropertyArtwork: albumArt

]

infoCenter.nowPlayingInfo = nowPlayingInfo

}

}

Page 212: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func populateNowPlayingInfo(item: MediaItem) {

let infoCenter = MPNowPlayingInfoCenter.defaultCenter()

if let image = item.albumArtwork ?? UIImage(named: "EmptyAlbum") {

let albumArt = MPMediaItemArtwork(boundsSize: item.albumArtworkSize, requestHandler: { (size) -> UIImage in

return image

})

let nowPlayingInfo = [

MPMediaItemPropertyTitle: item.title,

MPMediaItemPropertyArtist: item.artist,

MPMediaItemPropertyAlbumTitle: item.album,

MPMediaItemPropertyPlaybackDuration: item.duration,

MPMediaItemPropertyArtwork: albumArt

]

infoCenter.nowPlayingInfo = nowPlayingInfo

}

}

Page 213: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func populateNowPlayingInfo(item: MediaItem) {

let infoCenter = MPNowPlayingInfoCenter.defaultCenter()

if let image = item.albumArtwork ?? UIImage(named: "EmptyAlbum") {

let albumArt = MPMediaItemArtwork(boundsSize: item.albumArtworkSize, requestHandler: { (size) -> UIImage in

return image

})

let nowPlayingInfo = [

MPMediaItemPropertyTitle: item.title,

MPMediaItemPropertyArtist: item.artist,

MPMediaItemPropertyAlbumTitle: item.album,

MPMediaItemPropertyPlaybackDuration: item.duration,

MPMediaItemPropertyArtwork: albumArt

]

infoCenter.nowPlayingInfo = nowPlayingInfo

}

}

Page 214: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func populateNowPlayingInfo(item: MediaItem) {

let infoCenter = MPNowPlayingInfoCenter.defaultCenter()

if let image = item.albumArtwork ?? UIImage(named: "EmptyAlbum") {

let albumArt = MPMediaItemArtwork(boundsSize: item.albumArtworkSize, requestHandler: { (size) -> UIImage in

return image

})

let nowPlayingInfo = [

MPMediaItemPropertyTitle: item.title,

MPMediaItemPropertyArtist: item.artist,

MPMediaItemPropertyAlbumTitle: item.album,

MPMediaItemPropertyPlaybackDuration: item.duration,

MPMediaItemPropertyArtwork: albumArt

]

infoCenter.nowPlayingInfo = nowPlayingInfo

}

}

Page 215: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func populateNowPlayingInfo(item: MediaItem) {

let infoCenter = MPNowPlayingInfoCenter.defaultCenter()

if let image = item.albumArtwork ?? UIImage(named: "EmptyAlbum") {

let albumArt = MPMediaItemArtwork(boundsSize: item.albumArtworkSize, requestHandler: { (size) -> UIImage in

return image

})

let nowPlayingInfo = [

MPMediaItemPropertyTitle: item.title,

MPMediaItemPropertyArtist: item.artist,

MPMediaItemPropertyAlbumTitle: item.album,

MPMediaItemPropertyPlaybackDuration: item.duration,

MPMediaItemPropertyArtwork: albumArt

]

infoCenter.nowPlayingInfo = nowPlayingInfo

}

}

Page 216: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func playableContentManager(contentManager: MPPlayableContentManager,

initializePlaybackQueueWithContentItems contentItems: [AnyObject]?,

completionHandler: (NSError?) -> Void) {

guard let mediaItem = findMediaItemToPlay() else {

// Handle error, call completion handler with error and return

}

populateNowPlayingInfo(mediaItem: mediaItem)

guard let status = preparePlayback(mediaItem: mediaItem) else {

// Handle error, call completion handler with error and return

}

// Do other things that are required for success

completionHandler(nil)

}

Page 217: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func playableContentManager(contentManager: MPPlayableContentManager,

initializePlaybackQueueWithContentItems contentItems: [AnyObject]?,

completionHandler: (NSError?) -> Void) {

guard let mediaItem = findMediaItemToPlay() else {

// Handle error, call completion handler with error and return

}

populateNowPlayingInfo(mediaItem: mediaItem)

guard let status = preparePlayback(mediaItem: mediaItem) else {

// Handle error, call completion handler with error and return

}

// Do other things that are required for success

completionHandler(nil)

}

Page 218: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func playableContentManager(contentManager: MPPlayableContentManager,

initializePlaybackQueueWithContentItems contentItems: [AnyObject]?,

completionHandler: (NSError?) -> Void) {

guard let mediaItem = findMediaItemToPlay() else {

// Handle error, call completion handler with error and return

}

populateNowPlayingInfo(mediaItem: mediaItem)

guard let status = preparePlayback(mediaItem: mediaItem) else {

// Handle error, call completion handler with error and return

}

// Do other things that are required for success

completionHandler(nil)

}

Page 219: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

func playableContentManager(contentManager: MPPlayableContentManager,

initializePlaybackQueueWithContentItems contentItems: [AnyObject]?,

completionHandler: (NSError?) -> Void) {

guard let mediaItem = findMediaItemToPlay() else {

// Handle error, call completion handler with error and return

}

populateNowPlayingInfo(mediaItem: mediaItem)

guard let status = preparePlayback(mediaItem: mediaItem) else {

// Handle error, call completion handler with error and return

}

// Do other things that are required for success

completionHandler(nil)

}

Page 220: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

OverviewPromoting Your Media App

iOS promotes the app a user is likely to use based on behaviorSuggestions are offered in Spotlight and Today View If they follow a particular trigger, suggestions may be elevated to the lock screenFor example:• After plugging in headphones or a BT device (Podcasts, Music)• After getting in a car (Maps)• After arriving at home or work (Agenda app)

With a simple API, you can build a far more engaging lock screen experience

Page 221: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Location Suggestions

Media App Suggestions

Summary

NSUserActivity and schema.org

Page 222: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

SummaryProactive Suggestions

Page 223: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

SummaryProactive Suggestions

Simple APIs that deeply integrate your app to the OS

Page 224: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

SummaryProactive Suggestions

Simple APIs that deeply integrate your app to the OS• NSUserActivity—The “eyes” of the OS

Page 225: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

SummaryProactive Suggestions

Simple APIs that deeply integrate your app to the OS• NSUserActivity—The “eyes” of the OS• schema.org—Like NSUserActivity, but for the web

Page 226: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

SummaryProactive Suggestions

Simple APIs that deeply integrate your app to the OS• NSUserActivity—The “eyes” of the OS• schema.org—Like NSUserActivity, but for the web• MKDirectionsRequest and a new UIKit API—Build a seamless experience for handling locations

Page 227: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

SummaryProactive Suggestions

Simple APIs that deeply integrate your app to the OS• NSUserActivity—The “eyes” of the OS• schema.org—Like NSUserActivity, but for the web• MKDirectionsRequest and a new UIKit API—Build a seamless experience for handling locations• MPPlayableContentManager—Enhanced experience for media suggestions

Page 228: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

SummaryProactive Suggestions

Simple APIs that deeply integrate your app to the OS• NSUserActivity—The “eyes” of the OS• schema.org—Like NSUserActivity, but for the web• MKDirectionsRequest and a new UIKit API—Build a seamless experience for handling locations• MPPlayableContentManager—Enhanced experience for media suggestions

Easy to adopt, easy to test

Page 229: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

More Information

https://developer.apple.com/wwdc16/240

Page 230: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Related Sessions

Introducing SiriKit Presidio Wednesday 5:00PM

Making the Most of Search APIs Pacific Heights Thursday 11:00AM

Extending Your Apps with SiriKit Presidio Thursday 1:40PM

Adopting Handoff on iOS and OS X WWDC 2014

Introducing Search APIs WWDC 2015

Page 231: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

Labs

Proactive Suggestions Lab Frameworks Lab A Friday 3:00PM

Page 232: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

The more the systemknows about your app,

Page 233: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location

The more the systemknows about your app,

the more opportunity it will have to promote it.

Page 234: Increase Usage of Your App with Proactive Suggestions...Proactive Suggestions To learn when to promote you, the OS needs to know more about your data or app ... MapKit-based apps Location