skip to Main Content

I am working on a project where I aim to use an employee’s mobile device to unlock gates using NFC. The idea is that when a user taps their mobile device at an NFC reader, the device will send the required data, based on which login or logout will be triggered.

I have already implemented this functionality on Android using Host Card Emulation (HCE), and it’s working perfectly. However, I’m facing challenges with implementing the same on iOS.

Here’s my situation:

In European countries, iOS users can use HCE, but in India, HCE is not supported on iOS devices.
From my research, I found that it may be possible to use iOS HomeKit with NFC to achieve similar functionality.
I would like to know:

How can I send data to an NFC reader using iOS HomeKit or any other iOS-compatible method?
Is HomeKit the right approach, or is there any other iOS functionality that can help me achieve this?
Are there any alternatives to HCE on iOS that I can leverage, especially considering the regional restrictions on HCE?
Your guidance on this would be highly appreciated, as I am looking for a way to implement this effectively on iOS.

Thank you in advance!

Best regards,
Ravi Choudhary
Email : [email protected]

Nothing……………

2

Answers


  1. Example code –

    @IBAction func beginScanning(_ sender: Any) {
        guard NFCNDEFReaderSession.readingAvailable else {
            let alertController = UIAlertController(
                title: "Scanning Not Supported",
                message: "This device doesn't support tag scanning.",
                preferredStyle: .alert
            )
            alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
            self.present(alertController, animated: true, completion: nil)
            return
        }
    
    
        session = NFCNDEFReaderSession(delegate: self, queue: nil, invalidateAfterFirstRead: false)
        session?.alertMessage = "Hold your iPhone near the item to learn more about it."
        session?.begin()
    }
    
    • Go to this link for more details –

    https://developer.apple.com/documentation/corenfc/building_an_nfc_tag-reader_app

    Login or Signup to reply.
  2. Example code –

    @IBAction func beginScanning(_ sender: Any) {
        guard NFCNDEFReaderSession.readingAvailable else {
            let alertController = UIAlertController(
                title: "Scanning Not Supported",
                message: "This device doesn't support tag scanning.",
                preferredStyle: .alert
            )
            alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil))
            self.present(alertController, animated: true, completion: nil)
            return
        }
    
    
        session = NFCNDEFReaderSession(delegate: self, queue: nil, invalidateAfterFirstRead: false)
        session?.alertMessage = "Hold your iPhone near the item to learn more about it."
        session?.begin()
    }
    

    Write an NDEF Message

    @IBAction func beginWrite(_ sender: Any) {
        session = NFCNDEFReaderSession(delegate: self, queue: nil, invalidateAfterFirstRead: false)
        session?.alertMessage = "Hold your iPhone near an NDEF tag to write the message."
        session?.begin()
    }
    

    ……..

    • Go to this link for more details –

    https://developer.apple.com/documentation/corenfc/building_an_nfc_tag-reader_app

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search