NFC Forum Well Known Type Data Parser for iOS11 and Core NFC

Overview

NFCNDEFParse

NFC Forum Well Known Type Data Parser for iOS11 and Core NFC.

Supports parsing of types:

Text - NFCForum-TS-RTD_Text_1.0 2006-07-24

Uri - NFCForum-TS-RTD_URI_1.0 2006-07-24

Smart Poster - NFCForum-SmartPoster_RTD_1.0 2006-07-24 (title, uri, action, size)

Requirements

Core NFC requires iOS11 (and Xcode 9)

Installation

NFCNDEFParse is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'NFCNDEFParse'

Usage

Note: For non CocoaPods usage and more details see Examples!

Import the library.

Swift:

import NFCNDEFParse

Objective-C:

@import NFCNDEFParse;

Create array for the messages

var data: [NDEFMessageWithWellKnownTypes] = []

In CoreNFC callback create the "well know types" data array.

func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {
    data = messages.flatMap({ NDEFMessageWithWellKnownTypes(records: $0.records) })
}

Loop through the data array to print out the values.

data.forEach({ message in
    print("message: ")
    message.records.forEach({ record in
        print(record.description)
    })
})

Author

Jari Kalinainen, [email protected]

License

NFCNDEFParse is available under the MIT license. See the LICENSE file for more info.

You might also like...
Library for iOS Camera API. Massively increase performance and ease of use within your next iOS Project.
Library for iOS Camera API. Massively increase performance and ease of use within your next iOS Project.

CameraKit helps you add reliable camera to your app quickly. Our open source camera platform provides consistent capture results, service that scales,

Swift library to easily check the current device and some more info about it.
Swift library to easily check the current device and some more info about it.

Usage To run the example project, clone the repo, and run pod install from the Example directory first. let device = Deviice.current device is a Devi

Light weight tool for detecting the current device and screen size written in swift.
Light weight tool for detecting the current device and screen size written in swift.

Device detect the current  device model and screen size. Installation CocoaPods Device is available through CocoaPods. To install it, simply add the

WatchCon is a tool which enables creating easy connectivity between iOS and WatchOS.
WatchCon is a tool which enables creating easy connectivity between iOS and WatchOS.

WatchCon WatchCon is a tool which enables creating easy connectivity between iOS and WatchOS Requirements iOS 9.0+ / watchOS 2.0+ CocoaPods CocoaPods

Lightweight Cocoa library for detecting the running device's model and screen size.
Lightweight Cocoa library for detecting the running device's model and screen size.

Lightweight Cocoa library for detecting the running device's model and screen size. With the newer  devices, developers have more work to do. This li

Writes twitter and contact (links) to writable nfcs on iPhone 7+ iOS 14+
Writes twitter and contact (links) to writable nfcs on iPhone 7+ iOS 14+

nfc writer ios app nfc writer app is a hacky fun side project that writes twitter and contact (links) to writable nfcs. runs on iPhone 7+ iOS 14+. joi

EKAlgorithms contains some well known CS algorithms & data structures.

EKAlgorithms EKAlgorithms is a set of computer exercises implemented in Objective-C. Data structures, well known algorithms, CS curiosities, you name

AmiiboReader - Reading data from amiibo by using Core NFC

AmiiboReader Reading data from amiibo by using Core NFC NTAG215 Data Sheet https

Joplin - an open source note taking and to-do application with synchronization capabilities for Windows, macOS, Linux, Android and iOS. Forum: https://discourse.joplinapp.org/
Joplin - an open source note taking and to-do application with synchronization capabilities for Windows, macOS, Linux, Android and iOS. Forum: https://discourse.joplinapp.org/

Joplin® is a free, open source note taking and to-do application, which can handle a large number of notes organised into notebooks. The notes are sea

Scholarly Article Search, Discussion Forum and Discussion Board
Scholarly Article Search, Discussion Forum and Discussion Board

DiscussIt An app to throughly explore vast database of scholarly article, choosing one to experiment with, discuss with your friends An Open Source Ap

JSON to Core Data and back. Swift Core Data Sync.
JSON to Core Data and back. Swift Core Data Sync.

Notice: Sync was supported from it's creation back in 2014 until March 2021 Moving forward I won't be able to support this project since I'm no longer

WKZombie is a Swift framework for iOS/OSX to navigate within websites and collect data without the need of User Interface or API, also known as Headless browser. It can be used to run automated tests / snapshots and manipulate websites using Javascript. Core Data Generator (CDG for short) is a framework for generation (using Sourcery) of Core Data entities from plain structs/classes/enums.
Core Data Generator (CDG for short) is a framework for generation (using Sourcery) of Core Data entities from plain structs/classes/enums.

Core Data Generator Introduction Features Supported platforms Installation CDG Setup RepositoryType ModelType DataStoreVersion MigrationPolicy Basic U

WKZombie is a Swift framework for iOS/OSX to navigate within websites and collect data without the need of User Interface or API, also known as Headless browser.
WKZombie is a Swift framework for iOS/OSX to navigate within websites and collect data without the need of User Interface or API, also known as Headless browser.

WKZombie WKZombie is an iOS/OSX web-browser without a graphical user interface. It was developed as an experiment in order to familiarize myself with

Type-safe networking abstraction layer that associates request type with response type.

APIKit APIKit is a type-safe networking abstraction layer that associates request type with response type. // SearchRepositoriesRequest conforms to Re

A phantom type is a custom type that has one or more unused type parameters.

PhantomTypes A phantom type is a custom type that has one or more unused type parameters. Phantom types allow you to enforce type-safety without sacri

IOS-App4 - Core Data add new data and update data
IOS-App4 - Core Data add new data and update data

iOS-App4 Core Data add new data and update data.

👀 iOS11 demo application for age and gender classification of facial images.
👀 iOS11 demo application for age and gender classification of facial images.

Faces Vision Demo iOS11 demo application for age and gender classification of facial images using Vision and CoreML. Model This demo is based on the a

🏷 iOS11 demo application for predicting gender from first names.
🏷 iOS11 demo application for predicting gender from first names.

Names CoreML Demo A Demo application using CoreML framework for predicting gender from first names. Model This demo is based on An introduction to Mac

Comments
  • Get UID And Serial Number of the NFC Tag iOS

    Get UID And Serial Number of the NFC Tag iOS

    I'm developing an application in which I want to get the NFC serial number and Identifier of a NFC tag. When I press a button, I want the application to find the UID and serial number of the NFC card. The only problem is that I have no idea how to get the UID and and serial number if that's possible on iOS. I m trying to get NFC identifier but i don't know how to get serial number of NFC Tag.

    Code:-

    class ScanNFCTag: NFCTagReaderSessionDelegate {
    
    import CoreNFC
    
    var session: NFCTagReaderSession?
    
    func scanNFCTag(sender: UIButton!) {
         self.session = NFCTagReaderSession(pollingOption: .iso14443, delegate: self)
         self.session?.alertMessage = "Hold Your Phone Near the NFC Tag"
         self.session?.begin()
    }
    
    func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) {
        print("Session Begin!")
    }
    
    func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: Error) {
        print(error.localizedDescription)
    }
    
    func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
        if tags.count > 1{
            session.alertMessage = "More Than One Tag Detected, Please try again"
            session.invalidate()
        }
        
        let tag = tags.first!
        session.connect(to: tag) { (error) in
            if nil != error{
                session.invalidate(errorMessage: error?.localizedDescription ?? "")
            }
            if case let .miFare(sTag) = tag{
                let UID = sTag.identifier.map{ String(format:"%.2hhx", $0)}.joined()
                session.alertMessage = "Successfully linked tag to location"
                session.invalidate()
                DispatchQueue.main.async {
                    print("NFC Identifer = ", "\(UID)")
                   }
               }
           }
       }
    }
    

    So, Here is the my code please let me know if i m doing wrong please correct me. Can someone please explain to me how to get serial number and UID of NFC tag,

    Any help would be greatly appreciated.

    Thanks in advance.

    opened by shamdass 0
Releases(0.3.0)
Owner
Jari Kalinainen
Full stack superstar developer. Mainly Swift for iOS, but why stop there :D
Jari Kalinainen
DeviceKit is a value-type replacement of UIDevice.

Branch Build Status Versions master ≥ 2.0 Swift 4 - 4.2 ≥ 1.3 < 1.13 Swift 3 ≥ 1.0 < 1.3 Swift 2.3 < 1.0 DeviceKit is a value-type replacement of UIDe

DeviceKit 3.9k Dec 30, 2022
Get the data from Accelerometer, Gyroscope and Magnetometer in only Two or a few lines of code.

Get the data from Accelerometer, Gyroscope and Magnetometer in only Two or a few lines of code. CoreMotion now made insanely simple :octocat: :satellite:

Muhammad Haroon Baig 1.1k Nov 16, 2022
Simply the fastest way to transmit data between iOS/tvOS and OSX

DarkLightning DarkLightning is a lightweight Swift library to allow data transmission between iOS/tvOS devices (Lightning port, Dock connector, USB-C)

Jens Meder 318 Nov 29, 2022
Luminous provides you a lot of information about the system and a lot of handy methods to quickly get useful data on the iOS platform.

Luminous Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 8+ Swift 5 Xcode 1

Andrea Mario Lufino 324 Nov 27, 2022
AirQualityMonitoring - Here display the live air quality monitoring data

AirQualityMonitoring Here display the live air quality monitoring data. Details

MdNiks 0 Jan 28, 2022
A better way to operate QR Code in Swift, support iOS, macOS, watchOS and tvOS.

EFQRCode is a lightweight, pure-Swift library for generating stylized QRCode images with watermark or icon, and for recognizing QRCode from images, in

EFPrefix 4.3k Jan 2, 2023
🛰 CoreLocation Made Easy - Efficient & Easy Location Tracker, IP Location, Gecoder, Geofence, Autocomplete, Beacon Ranging, Broadcaster and Visits Monitoring

Location Manager Made Easy SwiftLocation is a lightweight Swift Library that provides an easy way to work with location-related functionalities. No mo

Daniele Margutti 3.2k Dec 30, 2022
Instagram-like photo browser and a camera feature with a few line of code in Swift.

NOTE: This project is no longer maintained. We highly recommend YPImagePicker. Fusuma Fusuma is a Swift library that provides an Instagram-like photo

Yuta Akizuki 2.4k Dec 31, 2022
A camera view controller with custom image picker and image cropping.

ALCameraViewController A camera view controller with custom image picker and image cropping. Features Front facing and rear facing camera Simple and c

Alex Littlejohn 2k Dec 29, 2022
:mag_right: A simple and beautiful barcode scanner.

Description BarcodeScanner is a simple and beautiful wrapper around the camera with barcode capturing functionality and a great user experience. Barco

HyperRedink 1.6k Jan 3, 2023