Core NFC

RSS for tag

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

Posts under Core NFC tag

65 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

NFC TAG Error
Good morning, I hope to find someone who knows better than me regarding reading NFC tags I'll explain what happens: if I read my card [iso 7816 nfc card with fingerprint reader] everything is fine. If I bring another card near it, for example the Italian tax code, it reads OK (so in the UI it says that it has been read) in the usual entitlement error log I honestly would prefer it to show the error: self.nfcSession?.invalidate(errorMessage: "Not a WiBioCard Otp Card") while I have precisely in the UI that everything went well.
1
0
75
3d
Request for Assistance with NFC-Based Door Unlocking Functionality
Dear Apple Developer Support, I hope this email finds you well. I am writing to seek your assistance regarding an advanced NFC functionality we aim to implement in our existing iOS application. Our application provides a mobile access solution for businesses, eliminating the need for traditional key fobs by enabling door access via smartphones. We are currently working on a feature to unlock doors using NFC tags. The NFC tags will contain specific information for each lock, and users will unlock the door by tapping their iPhone to the tag. To enhance the user experience, we aim to: Bypass the NFC prompt that requires user interaction to confirm the NFC read. Unlock the door without needing to open the app. Our goal is to provide a completely touchless and seamless access experience for our users. However, we understand that there are certain security and privacy constraints in place. We are looking for guidance on: Any potential solutions or workarounds that would allow us to achieve our desired functionality. Possibilities for requesting special permissions or utilising system-level APIs to enable background NFC reading and actions without user interaction. We appreciate any assistance or recommendations you can provide to help us deliver a superior user experience while adhering to iOS security guidelines. Thank you for your time and support. Best regards, Pavez
0
0
43
5d
Suppression of Apple Pay Passes in Amtrak Mobile App
Issue: Amtrak's state partner in New Jersey, SEPTA, has requested the incorporation of NFC suppression when an Amtrak mobile ticket is opened on their app. This feature ensures that NFC remains inactive and does not inadvertently bring up Apple Pay, Google Pay, etc., when customers are trying to scan their Amtrak tickets on SEPTA validators. Request: Amtrak is requesting to use the entitlement com.apple.developer.passkit.pass-presentation-suppression in our Amtrak app to suppress the display of Apple Pay passes when the app is in use. This is to prevent interference with the NFC reader during ticket validation, as illustrated in the attached screenshot from SEPTA's app, which shows a similar implementation with the message: "Payment cards and passes will not work automatically while NJ TRANSIT is in use." Entitlement Information: Entitlement Key: com.apple.developer.passkit.pass-presentation-suppression Boolean Value: YES Justification: The entitlement will enable the requestAutomaticPassPresentationSuppressionWithResponseHandler: method to keep the Amtrak app in the foreground when operating near NFC or other RF readers. This feature is crucial for ensuring seamless ticket scanning and validation for our passengers without the interference of Apple Pay or other digital wallets. Reference Documentation: For more information on this entitlement, please refer to the Apple Developer documentation: Apple Pay and PassKit Entitlements. Implementation: In our entitlement configuration file, we will add the following key: com.apple.developer.passkit.pass-presentation-suppression Supporting Evidence: The SEPTA app demonstrating the implementation of this feature can be found in the App Store. Amtrak seeks to implement a similar suppression mechanism, displaying the message: "Payment cards and passes will not work automatically while Amtrak app is in use." We seek Apple's approval for this implementation to prevent any potential rejection of our app store submission for incorporating this critical feature for our state partner's requirements. Thank you for your consideration.
2
0
143
6d
NFC class "NFFieldNotification" not loaded or does not exist
I am using NFC when the phone is near the NFC reader times below the error: 2024-07-15 15:43:03.608427+0800 TestNFC[16022:1038141] [xpc.exceptions] <NSXPCConnection: 0x282ba90e0> connection to service with pid 58 named com.apple.nfcd.service.corenfc: Exception caught during decoding of received selector didDetectExternalReaderWithNotification:, dropping incoming message. Exception: Exception while decoding argument 0 (#2 of invocation): Exception: decodeObjectForKey: class "NFFieldNotification" not loaded or does not exist my code: #import <CoreNFC/CoreNFC.h> @interface ViewController ()<NFCTagReaderSessionDelegate> @property (strong, nonatomic) NFCTagReaderSession *session; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.view.backgroundColor = [UIColor whiteColor]; if (@available(iOS 13.0, *)) { // 初始化 NFC 设置代理 NFCTagReaderSessionDelegate if (NFCNDEFReaderSession.readingAvailable) { self.session = [[NFCTagReaderSession alloc] initWithPollingOption:NFCPollingISO14443 delegate:self queue:nil]; // NFC 显示提示信息 self.session.alertMessage = @"准备扫描,请将卡片贴近手机"; // 开启 NFC [self.session beginSession]; } } else { } } #pragma mark - NFCNDEFReaderSessionDelegate //读取失败回调-读取成功后还是会回调这个方法 - (void)tagReaderSessionDidBecomeActive:(NFCTagReaderSession *)session API_AVAILABLE(ios(13.0)){ NSLog(@"tagReaderSessionDidBecomeActive"); } - (void)tagReaderSession:(NFCTagReaderSession *)session didInvalidateWithError:(NSError *)error API_AVAILABLE(ios(13.0)){ NSLog(@"readerSession:didInvalidateWithError: (%@)", [error localizedDescription]); } - (void)tagReaderSession:(NFCTagReaderSession *)session didDetectTags:(NSArray<__kindof id<NFCTag>> *)tags API_AVAILABLE(ios(13.0)){ }
0
0
76
6d
class "NFFieldNotification" not loaded or does not exist
I used NFC in my app, but When I iphone near the NFC device times the following error: 2024-07-15 14:10:24.882616+0800 TestNFC[1239:40733] [xpc.exceptions] <NSXPCConnection: 0x280d68e60> connection to service with pid 58 named com.apple.nfcd.service.corenfc: Exception caught during decoding of received selector didDetectExternalReaderWithNotification:, dropping incoming message. Exception: Exception while decoding argument 0 (#2 of invocation): Exception: decodeObjectForKey: class "NFFieldNotification" not loaded or does not exist my code is : @interface ViewController ()<NFCTagReaderSessionDelegate> @property (strong, nonatomic) NFCTagReaderSession *session; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.view.backgroundColor = [UIColor whiteColor]; if (@available(iOS 13.0, *)) { // 初始化 NFC 设置代理 NFCTagReaderSessionDelegate if (NFCNDEFReaderSession.readingAvailable) { self.session = [[NFCTagReaderSession alloc] initWithPollingOption:NFCPollingISO14443 delegate:self queue:nil]; // NFC 显示提示信息 self.session.alertMessage = @"准备扫描,请将卡片贴近手机"; // 开启 NFC [self.session beginSession]; } } else { } } #pragma mark - NFCNDEFReaderSessionDelegate //读取失败回调-读取成功后还是会回调这个方法 - (void)tagReaderSessionDidBecomeActive:(NFCTagReaderSession *)session API_AVAILABLE(ios(13.0)){ NSLog(@"tagReaderSessionDidBecomeActive"); } - (void)tagReaderSession:(NFCTagReaderSession *)session didInvalidateWithError:(NSError *)error API_AVAILABLE(ios(13.0)){ NSLog(@"readerSession:didInvalidateWithError: (%@)", [error localizedDescription]); } - (void)tagReaderSession:(NFCTagReaderSession *)session didDetectTags:(NSArray<__kindof id<NFCTag>> *)tags API_AVAILABLE(ios(13.0)){ }
0
0
66
6d
Possibilities of HCE with new EEU regulations
We want to use HCE or Wallet to use the iPhone on NFC readers that start EV chargers. They use the same tech as transit systems (MiFare and ISO 14443-4), but the backend systems only use the NFC UID for verification. Is it possible to use HCE (CardSession) or Wallet (Transit card) to transmit a static UID? If so, could our use-case go under either In-store purchase, loyalty programme, or transit? Or are those categories very rigid as to their use case? The new EEU regulation seems to open up this a bit.
1
0
174
1w
Regarding Reading NFC Core Information
I am developing an APP, scan and read NFC Tag information. I can only get the message in the NFC tag, but I cannot get the chip information. Or rather, the information obtained is incomplete. Look at the code: NFCNDEFReaderSession *session; - (void)readerSession:(NFCNDEFReaderSession *)session didDetectTags:(NSArray<__kindof id<NFCNDEFTag>> *)tags API_AVAILABLE(ios(13.0)) API_UNAVAILABLE(watchos, macos, tvos) { NSLog(@"call back ios13"); if (tags.count > 1) { session.alertMessage = LocalizedString(@"ErrorTips4"); [session restartPolling]; return; } id firstTag = tags.firstObject; HBNFCNDEFTag *ndefTag = firstTag; NSLog(@"ndefTag == %@", [ndefTag valueForKey:@"_tag"]); dispatch_async(dispatch_get_main_queue(), ^{ [self invalidateSession]; }); } Obtain datas: ndefTag == <NFTagInternal: 0x283db5c00>-BA5A89060AA01FAB { Tech=Unknown Type=Unknown ID=(null), NDEF=4, capacity=137, messageSize=45 } An Other: NFCTagReaderSession *tagSession; - (void)tagReaderSession:(NFCTagReaderSession *)session didDetectTags:(NSArray<__kindof id<NFCTag>> *)tags API_AVAILABLE(ios(13.0)) { NSLog(@"call back ios13 tag"); if (tags.count > 1) { session.alertMessage = LocalizedString(@"ErrorTips4"); [session restartPolling]; return; } id <NFCTag> firstTag = tags.firstObject; HBNFCTag *nfcTag = firstTag; NSLog(@"nfcTag == %@", [nfcTag valueForKey:@"_tag"]); dispatch_async(dispatch_get_main_queue(), ^{ [self invalidateTagSession]; }); } Obtain datas: nfcTag == <NFTagInternal: 0x283dac900>-BA5A890699350585 { Tech=A Type=MiFare UL ID=0426226AB37381 silentType=0 SAK=(null) ATQA=(null) sfgi=0x0 } I need datas: Tech、Type、ID、capacity、messageSize、SAK、ATQA What shall I do?
1
0
107
1w
RFID connection between iPhones
Hi, I'm inquiring in regards to the feasibility or possibility of making a connection from iPhone to another, such that one iPhone uses Apple wallet, and another iPhone would detect for the signal within the app. Please let me know if this is feasible or if any more information would be necessary to assist. If this is possible, what documentation would be relevant? Thank you.
1
0
172
1w
NFC TAG IPHONE
I have a client who asked me to create an app that reads nfc data, but this data needs to come from a built in iPhone nfc tag, so the app will read through nfc the SECOND device info. my question is, does the iPhone has a built in nfc tag? if so, can it share any device info?
1
0
149
1w
Bad user experience because of NFC timeouts
We are developing an app for the online identification function of the German National ID Card. https://github.com/Governikus/AusweisApp https://apps.apple.com/de/app/ausweisapp-bund/id948660805 Currently there are two NFC timeouts we are not able to influence because there is no API. A NFC Session has a maximum lifetime of 60 seconds, independent from any card communication. When a card was detected the connection will only last for 20 seconds. Combined there is also something like a worst case: The user presents the card 55 seconds after the session was started: The connection will only last for the remaining 5 seconds of the session. The identifications works as follow: The user clicks on a link on a website and our app will appear. After selecting access rights the NFC session is started. Sometimes the user start to search for their ID card now and this takes some time. When the 60 seconds are over we start a new session until there is a card or the user aborts. After establishing a secure channel with a PIN our app is a tunnel to allow a server a direct communication with the card. This takes some time. There are many identification aborts due to the unpredictable timeout, which cannot be controlled either by the API or by the user. We also have a use case where the iPhone can be used as a card reader over WiFi by an app on another device. It is essential to have a permanent NFC session without timeouts, as long as the user wants it in this case. Any idea how to deal with this situation? How can we disable this timeouts?
2
0
177
2w
launch app by scan NFC Tags
My app need a specific scene that play a video when my iPhone close to NFC Tags. and my app can read the data from NFC Tags, the data will tell us which kind of video can be play. I tried to write URLScheme or Universal Link in NFC Tags, but all this ways will pop up notifications. not launch my app and play a video, how can I design my app. please give me some advice, thanks!
1
0
221
3w
Unable to send Mifare commandos on iOS
I have created a Flutter application to scan Mifare DESFire cards on Android and iOS. I have tried using both flutter_nfc_kit and nfc_manager which both use CoreNFC. On both platforms, I can get the basic information on the card. However, only on Android, I can read data from the card by using Mifare commands. On iOS I am getting a 0B response. I have the following configuration inside my Runner.entitlements: <?xml version="1.0" encoding="UTF-8"?> <!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>TAG</string> </array> </dict> </plist> I have added the following keys inside my Info.plist file: <dict> <key>NFCReaderUsageDescription</key> <string>Access NFC</string> <key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key> <array> <string>D2760000850100</string> </array> ... </dict> However, I have noticed that I will get a different response if I add the D2760000850100 key in the Info.plist file. When I have this key added I get an error when executing a Mifare command: PlatformException(500, Communication error, Tag response error, null) So for that reason, I decided to remove the key altogether. Now everytime, I execute a Mifare command I end up with the response of 0B. Which does not tell me anything because it is not an official response. The Mifare command I am using is the select application command: 5A123456 where 123456 is the application ID. As mentioned before this works perfectly on Android. The only response I can get from the Mifare DESFire card is with an ISO7816 command: 00A4040006D2760000850100. Which is the select application command according to the ISO7816 standard. However, after executing this command I need to authenticate, which requires a complex algorithm. Is it necessary on iOS to first execute ISO7816 commands, before you can execute Mifare commands?
1
0
209
3w
About Background Tag Reading
Here is my write NDEF message code: let readerWriter = NFCReaderWriter.sharedInstance() let payloadData = NFCNDEFPayload(format: .nfcWellKnown, type: "U".data(using: .utf8)!, identifier: Data(), payload: "google.com".data(using: .utf8)!) let message = NFCNDEFMessage(records: [payloadData]) readerWriter.write(message, to: tags.first!) { (error) in if let err = error { print("ERR:\(err)") } else { print("write success") } self.readerWriter.end() } First Issue: When I want to read the NFC chip in the background without opening the app, I find the detection speed is not ideal. For example, this code writes "google.com" this time. When performing background reading, it does not successfully read every time the chip is near, and there seems to be a one-minute interval. Second Issue: When I implemented this method in the AppDelegate: - (BOOL)application:(UIApplication *)application continueUserActivity:(nonnull NSUserActivity *)userActivity restorationHandler:(nonnull void (^)(NSArray<id<UIUserActivityRestoring>> * _Nullable))restorationHandler { if (![userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) { return NO; } NSLog(@"userActivity: %@", userActivity.ndefMessagePayload); if (userActivity.ndefMessagePayload) { return YES; } return NO; } I found that userActivity.ndefMessagePayload outputs null. At the same time, looking at its private variables, it seems to have values: Printing description of userActivity->_internal->_payloadDataCache: { "com.apple.corenfc.useractivity.ndefmessagepayload" = {length = 546, bytes = 0x62706c69 73743030 d4010203 04050607 ... 00000000 0000019c }; } If ndefMessagePayload is null, how can I determine that it is an NSUserActivity from an NFC scan?
2
0
240
Jun ’24
Card Change on HCE-based contactless payment
Hi, I am integrating the HCE-based API into our SDK. Ideal flow It is bit tricky to support card change (step 3 below) after field-detect/double click due to NFC action sheet. Ideally, the flow is: User double-click. App launch "Hold near Reader" NFC instruction (optional) User change card User tap device to POS reader payment succeed. Approach A If I follow the code snippet in CardSession, where it calls startEmulation after readerDetected, I could change card before that. However, the "Hold near Reader" NFC instruction is shown very late, during tap. User double-click App launch (optional)User change card User tap device to POS reader "Hold near Reader" NFC instruction payment succeed. Approach B If I call startEmulation after sessionStarted, I could show "Hold near Reader" NFC. However, I could not provide the optional capability to change card anymore. User double-click App launch "Hold near Reader" NFC instruction User tap device to POS reader payment succeed. Neither approach A or B provide optimal approach shown in Ideal flow. Is this expected from CardSession that there is no option to startEmulation without the action sheet? Is there a plan to improve startEmulation so that it could show "Hold near Reader" without the action sheet? Thank you.
1
0
426
May ’24
When Rotate screen, a scanning sheet does not respond to any touch interactions
I have implemented NFC card reading functionality using NFCTagReaderSession. After starting the NFC reader session in landscape mode at least once, if I switch back to portrait mode and attempt to start the NFC reader session again, the scanning sheet does not respond to any touch interactions. Regardless of whether the screen is rotated, I expect the user to be able to close the reading screen, but it remains open. Is there any workaround for this issue? Code: class ViewController: UIViewController, NFCTagReaderSessionDelegate { func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) { } func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: any Error) { } func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) { } override func viewWillTransition(to size: CGSize, with coordinator: any UIViewControllerTransitionCoordinator) { super.viewWillTransition(to: size, with: coordinator) let session = NFCTagReaderSession(pollingOption: [.iso14443], delegate: self) session?.begin() } } PLATFORM AND VERSION iOS Device Information: Xcode 15.3 iPhone Xs (iOS 17.4) iPhone 8 (iOS 16.7.7) STEPS TO REPRODUCE Procedure and Results: 1.Launch the app. →The portrait mode is displayed. 2.Rotate from portrait to landscape. →The landscape screen shows the NFC reading interface. 3.Tap the cancel button on the NFC reading screen. →The landscape NFC reading screen closes. 4.Rotate back from landscape to portrait. →The portrait screen displays the NFC reading interface. 5.Tap the cancel button (cross icon) on the NFC reading screen. →The portrait NFC reading screen does not close.
0
0
199
May ’24
Send APDU Commands to iso7816 in background
Hello iPhone xs for testing XCode 15.3 I've successfully managed to select the AID and send other commands to a SmartCard using the following code: class NFCReader: NSObject, ObservableObject, NFCTagReaderSessionDelegate { func startNFCSession() { session = NFCTagReaderSession(pollingOption: [.iso14443], delegate: self, queue: nil) session?.alertMessage = "Hold your iPhone near the NFC tag." session?.begin() // Start the session } func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) { guard let tag = tags.first else { // Safely unwrap the first tag session.invalidate(errorMessage: "No SmartCard detected.") return } session.connect(to: tag, completionHandler: { (error: Error?) in if let error = error { session.invalidate(errorMessage: "Unable to connect to SmartCard: \(error.localizedDescription)") return } switch tag { case let .iso7816(iso7816Tag): self.sendAPDUCommandSelect(to: iso7816Tag) self.sendAPDUCommand_2(to: iso7816Tag) default: print("Not iso7816 type") // Update the SwiftUI view break } }) } } I encounter an issue when attempting to interact with the user for specific commands. I need to maintain the session active in the background while waiting for additional commands. However, upon closing the NFC dialog, I receive the NFCError Code=200 "Session invalidated by the user" error. My ideal use case: Button1: Initiates the connection and waits for the SmartCard to be presented. tagReaderSession() connects to the SmartCard and sends the AID. Button2: Sends APDU command 2. Button3: Sends APDU command 3. To proceed with clicking the other buttons, the NFC dialog must be closed, but doing so invalidates the session with error 200. Is there a way to keep the connection valid in the background while waiting for additional commands?
0
0
241
May ’24