All Projects → janlionly → NFCReaderWriter

janlionly / NFCReaderWriter

Licence: MIT license
NFCReaderWriter which supports to read data from NFC chips(iOS 11), write data to NFC chips(iOS 13) and read NFC tags infos(iOS 13) by iOS devices. Compatible with both Swift and Objective-C. I will appreciate you if give me a star on the top right of page.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to NFCReaderWriter

FudiNFC
💳 NFC Reader And Writer using Android devices by @romellfudi
Stars: ✭ 44 (-24.14%)
Mutual labels:  nfc, nfc-card-reader, nfc-tag, nfc-writer, nfc-reader
TonUINO
Alternative TonUINO Firmware
Stars: ✭ 112 (+93.1%)
Mutual labels:  mifare, nfc, nfc-tag, nfc-reader
nfc-tags
No description or website provided.
Stars: ✭ 15 (-74.14%)
Mutual labels:  nfc, mifare-ultralight, nfc-tag
react-native-status-keycard
React Native library to interact with Status Keycard using NFC connection
Stars: ✭ 20 (-65.52%)
Mutual labels:  nfc, nfc-card-reader, nfc-tag
nfsee
Read your Transit/Bank/ID cards on Android/iOS phone with NFSee App
Stars: ✭ 80 (+37.93%)
Mutual labels:  nfc, nfc-tag, nfc-reader
ruby-nfc
NFC library for Ruby programming language
Stars: ✭ 31 (-46.55%)
Mutual labels:  mifare, nfc, mifare-ultralight
Core-NFC-Example
An example project which demonstrate the usage of iOS 11 Core NFC framework.
Stars: ✭ 19 (-67.24%)
Mutual labels:  nfc, corenfc
Plantain
Android приложение для чтения/записи информации на карты Mifare Classic
Stars: ✭ 14 (-75.86%)
Mutual labels:  mifare, nfc
Mifareclassictool
An Android NFC app for reading, writing, analyzing, etc. MIFARE Classic RFID tags.
Stars: ✭ 2,698 (+4551.72%)
Mutual labels:  mifare, nfc
easypay
NFC smart cards and payment terminals in Nigeria
Stars: ✭ 41 (-29.31%)
Mutual labels:  mifare, nfc
NFCReader
Scan and decode NFC tags on iOS
Stars: ✭ 85 (+46.55%)
Mutual labels:  nfc, felica
NFCAndroid
This is a project to using android HCE by using Type-4-Tag Message to working both in iOS and Android
Stars: ✭ 80 (+37.93%)
Mutual labels:  nfc, nfc-card-reader
EasyNfc
[Android] A Android nfcLib
Stars: ✭ 30 (-48.28%)
Mutual labels:  nfc, nfc-card-reader
nfc-laboratory
NFC signal and protocol analyzer using SDR receiver
Stars: ✭ 41 (-29.31%)
Mutual labels:  nfc, nfc-tag
Margoulineur2000
NFC
Stars: ✭ 24 (-58.62%)
Mutual labels:  nfc, nfc-card-reader
ChameleonMini
The ChameleonMini is a versatile contactless smartcard emulator compliant to NFC. The ChameleonMini was first developed by KAOS. This is NOT the official repo for KAOS's ChameleonMini. For further information see the Getting Started Page
Stars: ✭ 350 (+503.45%)
Mutual labels:  nfc, iso15693
flutter nfc kit
Flutter plugin to provide NFC functionality on Android and iOS, including reading metadata, read & write NDEF records, and transceive layer 3 & 4 data with NFC tags / cards
Stars: ✭ 119 (+105.17%)
Mutual labels:  nfc, nfc-tag
android-nfc-http-tunnel
Android NFC HTTP Tunnel Demo
Stars: ✭ 28 (-51.72%)
Mutual labels:  nfc
nfc-manager
Flutter app for accessing the NFC features on Android and iOS.
Stars: ✭ 57 (-1.72%)
Mutual labels:  nfc
arduino-primo-tutorials
Here some tutorials to explain and show how to make use of the new features of the Arduino Primo and Arduino Primo Core, such as Wifi, BLE, NFC, InfraRed and various sensors. Hope you can find this helpful to create amazing stuff, save the planet or make a cool project to look smart at the dinning table with your uncles.
Stars: ✭ 12 (-79.31%)
Mutual labels:  nfc

NFCReaderWriter

Version Carthage Compatible License Platform Swift

Description

NFCReaderWriter which supports to read data from NFC chips(iOS 11), write data to NFC chips(iOS 13) and read NFC tags infos(iOS 13) by iOS devices. Compatible with both Swift and Objective-C.

Installation

CocoaPods

pod 'NFCReaderWriter'

Carthage

github "janlionly/NFCReaderWriter"

Swift Package Manager

.package(url: "https://github.com/janlionly/NFCReaderWriter.git", .upToNextMajor(from: "1.1.4")),

Usage

  1. Set your provisioning profile to support for Near Field Communication Tag Reading;

  2. Open your project target, on Signing & Capabilities tab, add the Capability of Near Field Communication Tag Reading;

  3. Remember to add NFCReaderUsageDescription key for descriptions to your Info.plist.

  4. Support for read tag identifier(iOS 13), you should add your NFC tag type descriptions to your Info.plist.

    (eg: like com.apple.developer.nfc.readersession.felica.systemcodes, com.apple.developer.nfc.readersession.iso7816.select-identifiers)

More information please run demo above.

/// ----------------------
/// 1. NFC Reader(iOS 11):
/// ----------------------
// every time read NFC chip's data, open a new session to detect
readerWriter.newReaderSession(with: self, invalidateAfterFirstRead: true, alertMessage: "Nearby NFC Card for read")
readerWriter.begin()

// implement NFCReaderDelegate to read NFC chip's data
func reader(_ session: NFCReader, didDetectNDEFs messages: [NFCNDEFMessage]) {
  for message in messages {
    for (i, record) in message.records.enumerated() {
      print("Record \(i+1): \(String(data: record.payload, encoding: .ascii))")
      // other record properties: typeNameFormat, type, identifier
    }
  }
  readerWriter.end()
}

/// ----------------------
/// 2. NFC Writer(iOS 13):
/// ----------------------
// every time write data to NFC chip, open a new session to write
readerWriter.newWriterSession(with: self, isLegacy: true, invalidateAfterFirstRead: true, alertMessage: "Nearby NFC Card for write")
readerWriter.begin()

// implement NFCReaderDelegate to write data to NFC chip
func reader(_ session: NFCReader, didDetect tags: [NFCNDEFTag]) {
	  // here for write test data
    var payloadData = Data([0x02])
    let urls = ["apple.com", "google.com", "facebook.com"]
    payloadData.append(urls[Int.random(in: 0..<urls.count)].data(using: .utf8)!)

    let payload = NFCNDEFPayload.init(
      format: NFCTypeNameFormat.nfcWellKnown,
      type: "U".data(using: .utf8)!,
      identifier: Data.init(count: 0),
      payload: payloadData,
      chunkSize: 0)

    let message = NFCNDEFMessage(records: [payload])

    readerWriter.write(message, to: tags.first!) { (error) in
        if let err = error {
            print("ERR:\(err)")
        } else {
            print("write success")
        }
        self.readerWriter.end()
     }
}

/// -------------------------
/// 3. NFC Tag Reader(iOS 13)
/// -------------------------
readerWriter.newWriterSession(with: self, isLegacy: false, invalidateAfterFirstRead: true, alertMessage: "Nearby NFC card for read tag identifier")
readerWriter.begin()

// implement NFCReaderDelegate to read tag info from NFC chip
func reader(_ session: NFCReader, didDetect tag: __NFCTag, didDetectNDEF message: NFCNDEFMessage) {
    let tagId = readerWriter.tagIdentifier(with: tag)
    let content = contentsForMessages([message])

    DispatchQueue.main.async {
      self.tagIdLabel.text = "Read Tag Identifier:\(tagId.hexadecimal)"
      self.tagInfoTextView.text = "TagInfo:\n\(tagInfosDetail)\nNFCNDEFMessage:\n\(content)"
    }
    self.readerWriter.end()
}

/// --------------------------------
/// other NFCReaderDelegate methods:
/// --------------------------------
func readerDidBecomeActive(_ session: NFCReader) {
  print("Reader did become")
}
func reader(_ session: NFCReader, didInvalidateWithError error: Error) {
  print("ERROR:\(error)")
}

Version Updates

V1.1.4

// You can change alertMessage anywhere before call 'readerWriter.end()' as follow:
readerWriter.alertMessage = "NFC Tag Info detected"

V1.1.3

// Updated: add alertMessage property when detected NFC successfully 
readerWriter.detectedMessage = "Your Read/Write NFC successful content."

V1.1.2

// Support for reading tag infos and NDEFMessage when the NFC chip was scanned once
func reader(_ session: NFCReader, didDetect tag: __NFCTag, didDetectNDEF message: NFCNDEFMessage)

V1.0.6

// Support for reading tag identifier
func reader(_ session: NFCReader, didDetect tag: __NFCTag) {
  let tagId = readerWriter.tagIdentifier(with: tag)
  // ...
}

Requirements

  • iOS 11.0+
  • Swift 4.2 to 5.2

Author

Visit my github: janlionly
Contact with me by email: [email protected]

Contribute

I would love you to contribute to NFCReaderWriter

License

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].