system frameworks #wwdc17€¦ · near field communication (nfc) close proximity wireless...

48
#WWDC17 © 2017 Apple Inc. All rights reserved. Redistribution or public display not permitted without written permission from Apple. Lawrence Chung, Wireless Technologies Introducing Core NFC Session 718 System Frameworks

Upload: others

Post on 14-Jun-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

#WWDC17

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

Lawrence Chung, Wireless Technologies

•Introducing Core NFC • Session 718

System Frameworks

Page 2: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

•About Near Field Communication •Core NFC •Requirements •Integration details •Example code

Page 3: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

•About Near Field Communication •Core NFC •Requirements •Integration details •Example code

Page 4: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Near Field Communication (NFC)

Close proximity wireless communication

RF technologies: NFC-A, NFC-B, NFC-F, NFC-V

NFC Data Exchange Format (NDEF)

Type 1 Topaz

Type 2 MIFARE Ultralight

Type 3 FeliCa

Type 4 DESFire Type 5

Tag Types

NFC-A NFC-B NFC-F NFC-VRF

Page 5: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

•About Near Field Communication •Core NFC •Requirements •Integration details •Example code

Page 6: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

NFC Tag Reading

Page 7: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

NFC Tag Reading

Page 8: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

NFC Tag Reading

Page 9: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

NFC Tag Reading

Page 10: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

NFC Tag Reading

NDEF formatted tags

Tag types 1 to 5

Available on iPhone 7 and iPhone 7 Plus

Page 11: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

•About Near Field Communication •Core NFC •Requirements •Integration details •Example code

Page 12: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

NFC Capability Core NFC requires an entitlement

For initial seed, visit https://developer.apple.com/account/ios/certificate

for manual request

Page 13: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

NFC Capability Core NFC requires an entitlement

For initial seed, visit https://developer.apple.com/account/ios/certificate

for manual request

Page 14: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

NFC Capability Core NFC requires an entitlement

For initial seed, visit https://developer.apple.com/account/ios/certificate

for manual request

Page 15: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Usage Description String Add “Privacy - NFC Scan Usage Description” in Info.plist

Page 16: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Usage Description String Add “Privacy - NFC Scan Usage Description” in Info.plist

Page 17: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Usage Description String Add “Privacy - NFC Scan Usage Description” in Info.plist

Page 18: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

•About Near Field Communication •Core NFC •Requirements •Integration details •Example code

Page 19: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Important Info Tag reading details with Core NFC

Page 20: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Important Info Tag reading details with Core NFC

Session is on demand

Page 21: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Important Info Tag reading details with Core NFC

Session is on demand

Foreground mode only

Page 22: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Important Info Tag reading details with Core NFC

Session is on demand

Foreground mode only

Maximum 60 seconds of scanning per session

Page 23: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Important Info Tag reading details with Core NFC

Session is on demand

Foreground mode only

Maximum 60 seconds of scanning per session

Configurable for single or multi-tag read operation

Page 24: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Important Info Tag reading details with Core NFC

Session is on demand

Foreground mode only

Maximum 60 seconds of scanning per session

Configurable for single or multi-tag read operation

Usage description will be shown over the top of your application

Page 25: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)
Page 26: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)
Page 27: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)
Page 28: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)
Page 29: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

•About Near Field Communication •Core NFC •Requirements •Integration details •Example code

Page 30: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Using Core NFC 3 easy steps to reading tags

Step 1—Adopt the NFCNDEFReaderSessionDelegate protocol

Step 2—Create a NFCNDEFReaderSession instance

Step 3—Start session and handle the delegate callbacks

Page 31: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

//CoreNFC NDEF Reader Session

import CoreNFC

class MessagesTableViewController: UITableViewController, NFCNDEFReaderSessionDelegate {

// MARK: NFCNDEReaderSessionDelegate func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) {

// Check invalidation reason from the returned error. Session will be invalidated after the function returns. New session instance is required to restart tag scanning.

}

func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {

// Process read NFCNDEFMessage objects. }

Page 32: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

//CoreNFC NDEF Reader Session

import CoreNFC

class MessagesTableViewController: UITableViewController, NFCNDEFReaderSessionDelegate {

// MARK: NFCNDEReaderSessionDelegate func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) {

// Check invalidation reason from the returned error. Session will be invalidated after the function returns. New session instance is required to restart tag scanning.

}

func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {

// Process read NFCNDEFMessage objects. }

Page 33: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

//CoreNFC NDEF Reader Session

import CoreNFC

class MessagesTableViewController: UITableViewController, NFCNDEFReaderSessionDelegate {

// MARK: NFCNDEReaderSessionDelegate func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) {

// Check invalidation reason from the returned error. Session will be invalidated after the function returns. New session instance is required to restart tag scanning.

}

func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {

// Process read NFCNDEFMessage objects. }

Page 34: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

//CoreNFC NDEF Reader Session

import CoreNFC

class MessagesTableViewController: UITableViewController, NFCNDEFReaderSessionDelegate {

// MARK: NFCNDEReaderSessionDelegate func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) {

// Check invalidation reason from the returned error. Session will be invalidated after the function returns. New session instance is required to restart tag scanning.

}

func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {

// Process read NFCNDEFMessage objects. }

Page 35: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

//CoreNFC NDEF Reader Session

import CoreNFC

class MessagesTableViewController: UITableViewController, NFCNDEFReaderSessionDelegate {

// MARK: NFCNDEReaderSessionDelegate func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) {

// Check invalidation reason from the returned error. Session will be invalidated after the function returns. New session instance is required to restart tag scanning.

}

func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {

// Process read NFCNDEFMessage objects. }

Page 36: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

//CoreNFC NDEF Reader Session

import CoreNFC

class MessagesTableViewController: UITableViewController, NFCNDEFReaderSessionDelegate {

// MARK: NFCNDEReaderSessionDelegate func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) {

// Check invalidation reason from the returned error. Session will be invalidated after the function returns. New session instance is required to restart tag scanning.

}

func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {

// Process read NFCNDEFMessage objects. }

Page 37: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

// MARK: - Actions @IBAction func beginScanning(_ sender: Any) {

let session = NFCNDEFReaderSession(delegate: self, queue: nil, invalidatedAfterFirstRead: true) session.begin()

} }

Page 38: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

// MARK: - Actions @IBAction func beginScanning(_ sender: Any) {

let session = NFCNDEFReaderSession(delegate: self, queue: nil, invalidatedAfterFirstRead: true) session.begin()

} }

Page 39: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

// MARK: - Actions @IBAction func beginScanning(_ sender: Any) {

let session = NFCNDEFReaderSession(delegate: self, queue: nil, invalidatedAfterFirstRead: true) session.begin()

} }

Page 40: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Summary

Page 41: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Summary

•Enable NFC tag reading capability

Page 42: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Summary

•Enable NFC tag reading capability

•Add “Privacy - NFC Scan Usage Description” in Info.plist

Page 43: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Summary

•Enable NFC tag reading capability

•Add “Privacy - NFC Scan Usage Description” in Info.plist

•Add Core NFC to your application

Page 44: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Summary

•Enable NFC tag reading capability

•Add “Privacy - NFC Scan Usage Description” in Info.plist

•Add Core NFC to your application

•Happy tag reading!!

Page 45: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

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

Page 46: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Related Sessions

Privacy and Your Apps Executive Ballroom Tuesday 11:20AM

What’s New in Apple Pay and Wallet Executive Ballroom Thursday 5:10PM

Page 47: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)

Labs

Apple Pay and Wallet Technology Lab J Friday 9:00AM–12:00PM

Page 48: System Frameworks #WWDC17€¦ · Near Field Communication (NFC) Close proximity wireless communication RF technologies: NFC-A, NFC-B, NFC-F, NFC-V NFC Data Exchange Format (NDEF)