Core NFC

RSS for tag

Detect NFC tags, read messages that contain NDEF data, and save data to writable tags using Core NFC.

Core NFC Documentation

Posts under Core NFC tag

59 Posts
Sort by:
Post not yet marked as solved
0 Replies
363 Views
Did anybody encounter issues while doing an NFC tag reading, particularly on the "Pro" devices? Based on our statistics, almost half of the readings with iPhone 12 Pro failed, due to NFC tag connection issues. Please see below the failure rate: Top 3 devices: iPhone 12 Pro with 41,5% failure rate iPhone 11 Pro Max with 33,3% failure rate iPhone SE 2nd Gen with 25% failure rate If we take into consideration the deviation from expected value, see below: The following types had a higher error value than statistically expected when used significantly: iPhone 14 Pro iPhone 12 Pro iPhone 15 Pro   The following types, on the other hand, had few to no reading errors with statistically relevant use: iPhone 14  iPhone 13 iPhone 13 Pro Max The essential questions are:  What are the differences between the iPhone 14 and iPhone 14 Pro in terms of NFC reading functionality?  What are the differences between the iPhone 11 Pro and iPhone 12 Pro in terms of NFC reading functionality? See list of device codes: here.
Posted
by
Post not yet marked as solved
0 Replies
376 Views
I'm trying to implement CoreNFC in my iOS project, so I need to add the Near Field Communication Tag Reading to my capabilities, however, I can't find it anywhere. After a bit of research, someone said that they had to enroll in Apple's developer program, is that necessary to unlock this capability? If not, how can I fix it?
Posted
by
Post not yet marked as solved
0 Replies
443 Views
It's my first time posting here so I don't really know what to do. I'm fairly new to iOS development and I have project that I need to make that uses NFC (CoreNFC). As I encountered errors in my code, I realized I needed to add the NFC capability however it's not showing in the capabilities list. After a bit of research, I found someone saying I needed to have an Apple Developer account (for 99$) to unlock this feature. Is this true? If not, what can I do to add the Near Field Communication Tag Reading capability to my project?
Posted
by
Post not yet marked as solved
1 Replies
429 Views
Hello, I have ICode Slix and Slix 2 NFC tags. I'm working on an iOS app for reading and writing data to these tags. I've tried various approaches, but I'm having trouble with the writing part. Could you please assist me in understanding how to write encode URL in that tags Here's my current code Because these tag is not bydefault NDEF format and I want to right url in that tag and make it NDEF formattable. I tried to write data with NFC Tool application it can write data easily in that but my code doesn't work. how to right data in NFC forum type 5 tags? func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) { print("Connecting To Tag") if tags.count > 1 { session.alertMessage = "More Than One Tag Detected, Please try again" session.invalidate() return } let tag = tags.first! session.connect(to: tag) { error in if let error = error { session.invalidate(errorMessage: "Connection Failed: \(error.localizedDescription)") return } if case let .iso15693(sTag) = tag { let textToWrite = "hello" if let textData = textToWrite.data(using: .utf8) { sTag.writeSingleBlock(requestFlags: [.highDataRate], blockNumber: 0x05, dataBlock: textData) { error in if let error = error { print("Error writing to NFC tag: \(error.localizedDescription)") } else { print("Data successfully written to NFC tag.") } session.invalidate() } } else { print("Error encoding text to data") session.invalidate() } } } }
Posted
by
Post not yet marked as solved
2 Replies
1.8k Views
I am trying to transfer data from one device to another using NFC. I'm trying to figure out if this is possible, I downloaded apple's sample project about CoreNFC, I was able to read NFC Tags (it wasn't a real NFC Tag, rather it was an NFC Tag emulated with an android device). Can I use my iPhone to emulate an NFC Tag to transfer data to another iPhone or Android device?
Posted
by
Post not yet marked as solved
0 Replies
378 Views
I bought RFID card: NFC 13.56MHz ISO14443A but Iphone can`t read it. What types of RFID card Iphone can read. Is there any specifictaion what cards Iphone can read?
Posted
by
Post not yet marked as solved
1 Replies
1.3k Views
Hi, I was using NFCNDEFReaderSessionDelegate at first to read and write the cards, but didDetect tags method did not detect any tag because my nfc tag is not pre-formatted, it was calling other delegate methods so I have my NFCNDEFReaderSessionDelegate setup correctly. Hence, I used NFCTagReaderSessionDelegate, didDetect tags method of NFCTagReaderSessionDelegate detected tag and the tag was not pre-formatted. The issue I have been facing is I am not able to write for the first time and getting an error Error Domain=NFCError Code=102 "Tag Not NDEF formatted" UserInfo={NSLocalizedDescription=Tag Not NDEF formatted}. When I used another app from apple store to write data on the same tag which is not pre-formatted. Using that app, I am able to write the data on that tag. That app was using CoreNFC framework I believe, as it has NFC session alert which seems it was from apple library CoreNFC, so I assume that there must be a way to write the data on unformatted nfc tags. Do I have to use any low level of commands? I am not sure how can I fix this issue. Please provide some sample code, suggestions, right path to make the tag ready to have NDEF format and able to write the data on it. Here is my NFC tag details:
Posted
by
Post not yet marked as solved
0 Replies
416 Views
we are using the STMicroelectronics/STNFCSensor tag, the tag configuration is Block Size: 4 Memory size in blocks: 2048 memory size in bytes: 8192 tag type: iso15693 Below i added my code func readSingleBlock(to tag: NFCTag, blockNumber: Int, completion: @escaping (Data) -> Void) { bfprint("NFC_Tag enter extendedReadSingleBlock blockNumber: \(blockNumber)") if case let .iso15693(tagIso15693) = tag { tagIso15693.extendedReadSingleBlock(requestFlags: [.highDataRate], blockNumber: blockNumber) { result in bfprint("NFC_Tag extendedReadSingleBlock \(result)") switch result { case .success(let data): self.retryAttempt = 0 bfprint("NFC_Tag Success tag response:", "\(data), ") completion(data) case .failure(let error): if self.retryAttempt > 5 { bfprint("NFC_Tag failure: \(error) \(error.localizedDescription) ") self.session?.invalidate(errorMessage: error.localizedDescription) } else { self.retryAttempt += 1 bfprint("NFC_Tag failure retryAttempt: \(self.retryAttempt) ") self.retryConnection() } } } } } func retryConnection() { guard let session, let tag = self.tag else { return } session.connect(to: tag) { [weak self] (error) in if let error = error { print("Retry connection error: \(error.localizedDescription)") self?.session?.invalidate(errorMessage: "Retry connection error: \(error.localizedDescription)") return } self?.readNfcTag(tag: tag) } } extendedReadSingleBlock function giving error "NFCError Code=100 “Tag connection lost”
Posted
by
Post not yet marked as solved
0 Replies
310 Views
I am aware of NFC and UWB api which I have already gone through the official document page. We have to create CCC based digital keys so we are going to use UWB, NFC technologies. So Is there any CCC based UWB,NFC api available for development? We are members of the CCC organization. Could you please support us for this.
Posted
by
Post not yet marked as solved
0 Replies
351 Views
We have to create CCC based digital keys so we are going to use UWB, NFC technologies. So Is there any CCC based UWB,NFC api available for development? We are members of the CCC organization. Could you please support us for this I have gone through UWB NFC document from official apple website.But I want to get idea on CCC based NFC and UWBs.
Posted
by
Post not yet marked as solved
1 Replies
390 Views
my app store application have met this problem most at OS version 16.6 and other OS version when i use [NFCReaderSession featureAvailable:],and Near Field Communication capability is equiped。I have no idea why this would happen。
Posted
by
Post not yet marked as solved
0 Replies
583 Views
IPhone 14 Pro - ios 17 Beta NFC tag reader no longer functioning as of ios15 update. I have updated to Beta 17 and still not working. Airfrop off, cellular data off and have completed several restarts. Any help with repairing is appreciated. Thank you.
Posted
by
Post not yet marked as solved
0 Replies
502 Views
Hey, I don't know why i can not make scan function work. I have written in the entitlement file: <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>com.apple.developer.nfc.readersession.formats</key> <array> <string>NDEF</string> <string>TAG</string> </array> </dict> </plist> also in the info.plist: <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key> <array> <string>A0000002471001</string> <string>D2760000850101</string> <!-- Add more AIDs as needed --> </array> still get the error Error Domain=NFCError Code=2 "Missing required entitlement" of course when i remove the iso18092 enum everything is working. Help? thanks
Posted
by
Post not yet marked as solved
0 Replies
613 Views
Hello! Thank you very much for your WWDC NFC sessions! I really like the format and the information you provided in those session :) I have a question regarding my app that I am planning to develop using an NFC technology. I tried to find a necessary information in WWDC sessions and documentations but I couldn't find anything that might be helpful for me. The idea is simple. I want to use my app as the proxy between user's payments cards (debit or credit) and the payment terminal. The logic is something like this: User taps an iPhone to a payment terminal (just like in the Wallet) and my app reads the data from the payment terminal through NFC (merchant name, merchant category, amount to be paid, etc.) My app receives this information, does some formatting and other operations My app sends the user's card information to the NFC (a card information is received and stored in my app through some 3rd party service, like Plaid) Payment terminal receives this information and shows either the payment succeed or failed. I am wondering is it possible to achieve this using the current API of NFC framework? While I am aware that the NFC framework supports the ISO-7816 standard, based on my research so far, it seems there is no way to achieve this functionality. Correct me if I am wrong. Thanks!
Posted
by
Post not yet marked as solved
0 Replies
542 Views
We are using an NFC tag that complies with ISO14443A and B standards (ISO-DEP) and supports ISO/IEC 7816 security. We are attempting to write some data using CoreNFC's NFCNDEFReaderSessionDelegate. We can detect the tag, but when we try to connect to it, it displays NFC Error (Tag Connection Lost). We also attempted NFCTagReaderSessionDelegate, but we were unable to detect the tag at that moment. Note that we have included the Privacy - NFC Reader Usage Description and ISO7816 application IDs for NFC Tag Reader Session to info.plist. Tag Reader Session Formats for Near Field Communication in entitlements.plist Can you advise on whether the problem is caused by the tag we're using? Or the CoreNFC library does not support writing? Thank you for your valuable time and assistance
Posted
by
Post not yet marked as solved
2 Replies
1k Views
I am developing an iOS app in which the device(iPhone) needs to act as an NFC tag using Felica so that an NFC reader could read the information present in this virtual tag (like person details). Currently Suica and Pasmo is being used for contact less payment but we ant to use the same technique but for our IOS app. Is it possible to achieve this ?
Posted
by
Post not yet marked as solved
0 Replies
634 Views
Hello All, I am using the sample code provided in this website https://developer.apple.com/documentation/corenfc/building_an_nfc_tag-reader_app I modified the MessagesTableViewController file to read and authenticate the Ntag213 tag. Since the Ntag213 is compatible with Mifare Commands. I used that in my code. I have attached the code below. import UIKit import CoreNFC /// - Tag: MessagesTableViewController class MessagesTableViewController: UITableViewController, NFCNDEFReaderSessionDelegate { // MARK: - Properties let reuseIdentifier = "reuseIdentifier" var detectedMessages = [NFCNDEFMessage]() var session: NFCNDEFReaderSession? // MARK: - Actions /// - Tag: beginScanning @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() } // MARK: - NFCNDEFReaderSessionDelegate /// - Tag: processingTagData func readerSession(_ session: NFCNDEFReaderSession, didDetectNDEFs messages: [NFCNDEFMessage]) { DispatchQueue.main.async { // Process detected NFCNDEFMessage objects. self.detectedMessages.append(contentsOf: messages) self.tableView.reloadData() } } func addMessage(fromUserActivity ndefMessage: NFCNDEFMessage) { // Add the message to the list of detected messages detectedMessages.append(ndefMessage) // Reload the table view tableView.reloadData() } func readerSession(_ session: NFCNDEFReaderSession, didDetect tags: [NFCNDEFTag]) { guard let tag = tags.first else { return } session.connect(to: tag) { error in if let error = error { // Handle connection error print(error.localizedDescription) session.invalidate() return } if let miFareTag = tag as? NFCMiFareTag { // Get the password and PACK values from base64 let pwdBytes = Data(base64Encoded: "ABCDEFG")! let packBytes = Data(base64Encoded: "XYZ")! // Authenticate the tag let authenticationCommand = Data([0x1B] + pwdBytes.map { $0 as UInt8 }) miFareTag.sendMiFareCommand(commandPacket: authenticationCommand) { response, error in if let error = error { // Authentication failed print("The tag is not authenticated") session.invalidate() return } // Authentication succeeded // Continue with further operations if response == packBytes { print("The tag is authenticated") } else { print("The tag is not authenticated") } } } else { // Handle unsupported tag type session.invalidate() } } } func readerSession(_ session: NFCNDEFReaderSession, didInvalidateWithError error: Error) { // Check the invalidation reason from the returned error. if let readerError = error as? NFCReaderError { // Show an alert when the invalidation reason is not because of a // successful read during a single-tag read session, or because the // user canceled a multiple-tag read session from the UI or // programmatically using the invalidate method call. if (readerError.code != .readerSessionInvalidationErrorFirstNDEFTagRead) && (readerError.code != .readerSessionInvalidationErrorUserCanceled) { let alertController = UIAlertController( title: "Session Invalidated", message: error.localizedDescription, preferredStyle: .alert ) alertController.addAction(UIAlertAction(title: "OK", style: .default, handler: nil)) DispatchQueue.main.async { }}}}}
Posted
by