iOS 13, Swift 5, Core NFC MiFare Classic 1K not detected

Published

i have a very fundamental issue when reading from a rfid chip using ios 13+ and swift 5, i have two setups (NFCNDEFReaderSession and NFCTagReaderSession),

NFCNDEFReaderSession:

import UIKit
import CoreNFC

class ViewController: UIViewController {

    var session: NFCNDEFReaderSession?

    override func viewDidLoad() {
        super.viewDidLoad()

        session = NFCNDEFReaderSession(delegate: self, queue: DispatchQueue.main, invalidateAfterFirstRead: false)
        session?.begin()
    }

}

extension ViewController: NFCNDEFReaderSessionDelegate {

    func readerSessionDidBecomeActive(_ session: NFCNDEFReaderSession) {
        print("active") // called once
    }

    func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) {
        print("didDetectNDEFs") // never called
    }

    func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) {
        print(error.localizedDescription) // only called on timeout
    }

}

NFCTagReaderSession:

import UIKit
import CoreNFC

class ViewController: UIViewController {

    var session: NFCTagReaderSession?

    override func viewDidLoad() {
        super.viewDidLoad()

        session = NFCTagReaderSession(pollingOption: NFCTagReaderSession.PollingOption.iso14443, delegate: self, queue: DispatchQueue.main)
        session?.begin()
    }

}

extension ViewController: NFCTagReaderSessionDelegate {

    public func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) {
        print("active") // called once
    }

    public func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
        print("didDetect") // never called
    }

    public func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: Error) {
        print(error.localizedDescription) // only called on timeout
    }

}

My hardware (NEW):

YARONGTECH Rfid chip 13.56 mhz MIFARE Classic® 1K tag – 10pcs

from amazon:

https://www.amazon.de/YARONGTECH-Classic%C2%AE-Schl%C3%BCsselanh%C3%A4nger-13-56MHz-ISO14443A/dp/B0749LSMLH/ref=sr_1_1?__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&dchild=1&keywords=YARONGTECH+Rfid+chip+13.56+mhz+MIFARE+Classic%C2%AE+1K+tag&qid=1592258266&s=diy&sr=1-1

In both scenarios the “didDetectNDEFs” and the “didDetect” methods never get called.

I went through apple documentation:
https://developer.apple.com/documentation/corenfc
and they actually claim it is possible(A reader session for detecting ISO7816, ISO15693, FeliCa, and MIFARE tags.), but how?..

This guy also claims he could read from these rfid chips:
Detect ISO/IEC 14443 (Mifare Ultralight or Classic) NFC Cards with CoreNFC

Please respond only if you know the answer

Source: Ios

Published
Categorized as core-nfc, ios, mifare, rfid, swift

Answers

hi @Creative crypter
did you find any solution? I am trying to achieve the same thing but not succeeded.


sam

Leave a Reply

Your email address will not be published. Required fields are marked *

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq