View in English

  • 메뉴 열기 메뉴 닫기
  • Apple Developer
검색
검색 닫기
  • Apple Developer
  • 뉴스
  • 둘러보기
  • 디자인
  • 개발
  • 배포
  • 지원
  • 계정
페이지에서만 검색

빠른 링크

5 빠른 링크

비디오

메뉴 열기 메뉴 닫기
  • 컬렉션
  • 주제
  • 전체 비디오
  • 소개

WWDC20 컬렉션으로 돌아가기

스트리밍은 대부분의 브라우저와
Developer 앱에서 사용할 수 있습니다.

  • 소개
  • 자막 전문
  • 코드
  • What's new in Core NFC

    Core NFC helps you scan and write to NFC tags in your apps, helping people get more from objects like parking meters, scooter rentals, car charging stations, and more. Learn about Core NFC's support for the ISO15693 protocol and new tag capabilities, and find out more about syntax improvements for Swift.

    리소스

    • Creating NFC Tags from Your iPhone
      • HD 비디오
      • SD 비디오

    관련 비디오

    WWDC19

    • Core NFC Enhancements
  • 비디오 검색…

    Hello and welcome to WWDC.

    Hi, my name is Lawrence and I work on NFC software here at Apple.

    Today we will go over the changes in our existing APIs. These changes follow some of the new published Swift guidelines.

    We have also expanded our APIs for the ISO15693 tag used in NFCTagReaderSession. First, let's start with an overview of Core NFC. You may recall our creative salmon from our last year WWDC presentation.

    By the way, his name is Kevin.

    Today I have brought Kevin with me and here is the coupon tag.

    Core NFC allows your app to read this NFC tag using an iPhone.

    NFC is also used in other places, such as on parking meters, scooter rental, electric car charging station, ordering menu in restaurant, et cetera. Core NFC allows an app to read an NFC tag in a session lasting up to 60 seconds. This has been supported on iPhones since the iPhone 7. Beginning on the iPhone XS, tags can also be read in the background while the screen is on, if the NFC forum NDEF message contains a universal link. Once the user has tapped on the notification banner shown on screen that NDEF message will be sent to your application as an NSUserActivity via UIApplicationDelegate restorationHandler. Texts may contain a NFC forum NDEF message or other proprietary data set.

    Core NFC supports NDEF reading and writing as well as other native tag protocols.

    The easiest path for tag access is to use the NFCNDEFReaderSession.

    Core NFC supports NDEF reading and writing as well as other native tag protocols.

    The easiest path for tag access is to use the NFCNDEFReaderSession. But Core NFC also supports raw tag communication via ISO7816, FeliCa, MIFARE and ISO15693. Next, let's talk about some changes to the Swift syntax to make it easier to understand your Core NFC code.

    Core NFC now adopts the use of the Result enum in our tag APIs, specifically how parameters are returned in our completion handler. Let's look at the ISO7816-tag-send-command as an example. Before iOS 14, the method signature accepts a closure with four arguments as the completion handler. Your application will need to check the optional error object to determine if an error occurs. If the operation succeeds, you may then parse the rest of arguments to collect the results. The new signature in iOS 14 returns a Result enum of either a NFCISO7816-Response-APDU object on success, which is the result of reading the tag, or an error object on a failure. The Result enum can be easily handled using a switch statement as shown.

    Now let me show you how it looks in Xcode.

    I've opened the NFCFishTag sample project from WWDC 2019. Here, in CouponViewController, the write function is shown in its existing form. Let's replace the send-MIFARE-command using its new Result signature.

    Here, in the new code, the data object is handled in this section of a switch statement. An error is handled over here.

    We have also made a few changes to the existing enum values to improve readability. For example, the ResolveFlag enum has been changed to refer specifically to ISO15693. Some other new enums have been added as well. Please refer to the documentation for more details. Now we will talk about new capabilities we've added to the NFC-ISO15693 tag protocol. We have added the enhancement defined by the ISO15693 specification third edition 2019. These functions are useful for tags with larger memory sizes and security operations. We have also included a new generic send command if you would like to send arbitrary data packets for your application. Here is a complete list of the enhancement function signatures under the NFC-ISO15693Tag protocol.

    We now support the following operations: fast reading multiple blocks, extended write multiple blocks, authenticate, key update, challenge, read buffer, extended get multiple blocks security status, extended fast read multiple blocks and send request.

    That's what new in Core NFC this year. We look forward to seeing what you can make with it.

    • 3:24 - sendCommand

      detectedTag.sendCommand(apdu: apdu) { (result: Result<NFCISO7816ResponseAPDU, Error>) in
         switch result {
         case .success(let responseAPDU):
            /// Handle NFCISO7816ResponseAPDU object.
         case .failure(let error):
            /// Handle Error object.
         }
      }
    • 4:06 - sendMiFareCommand

      // You need to zero-pad the data to fill the block size
      if blockData.count < blockSize {
        blockData += Data(count: blockSize - blockData.count)
      }
      
      let writeCommand = Data([writeBlockCommand, offset]) + blockData
      tag.sendMiFareCommand(commandPacket: writeCommand) { (response: Result<Data, Error>) in
        switch (response) {
        case .success(let responseData):
          if responseData[0] != successCode {
            self.readerSession?.invalidate(errorMessage: "Write tag error. Please try again.")
            return
          }
          
          let newSize = data.count - blockSize
          if newSize > 0 {
            self.write(data.suffix(newSize), to: tag, offset: (offset + 1))
          } else {
            self.readerSession?.invalidate()
          }
        case .failure(let error):
          let message = "Write tag error: \(error.localizedDescription). Please try again."
          self.readerSession?.invalidate(errorMessage: message)
        }
      }

Developer Footer

  • 비디오
  • WWDC20
  • What's new in Core NFC
  • 메뉴 열기 메뉴 닫기
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    메뉴 열기 메뉴 닫기
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • SF Symbols
    메뉴 열기 메뉴 닫기
    • 손쉬운 사용
    • 액세서리
    • 앱 확장 프로그램
    • App Store
    • 오디오 및 비디오(영문)
    • 증강 현실
    • 디자인
    • 배포
    • 교육
    • 서체(영문)
    • 게임
    • 건강 및 피트니스
    • 앱 내 구입
    • 현지화
    • 지도 및 위치
    • 머신 러닝
    • 오픈 소스(영문)
    • 보안
    • Safari 및 웹(영문)
    메뉴 열기 메뉴 닫기
    • 문서(영문)
    • 튜토리얼
    • 다운로드(영문)
    • 포럼(영문)
    • 비디오
    메뉴 열기 메뉴 닫기
    • 지원 문서
    • 문의하기
    • 버그 보고
    • 시스템 상태(영문)
    메뉴 열기 메뉴 닫기
    • Apple Developer
    • App Store Connect
    • 인증서, 식별자 및 프로파일(영문)
    • 피드백 지원
    메뉴 열기 메뉴 닫기
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program(영문)
    • News Partner Program(영문)
    • Video Partner Program(영문)
    • Security Bounty Program(영문)
    • Security Research Device Program(영문)
    메뉴 열기 메뉴 닫기
    • Apple과의 만남
    • Apple Developer Center
    • App Store 어워드(영문)
    • Apple 디자인 어워드
    • Apple Developer Academy(영문)
    • WWDC
    Apple Developer 앱 받기
    Copyright © 2025 Apple Inc. 모든 권리 보유.
    약관 개인정보 처리방침 계약 및 지침