hansemannn / ios-nfc-example Goto Github PK
View Code? Open in Web Editor NEW๐ฑ Example showing how to use the Core NFC API in iOS
๐ฑ Example showing how to use the Core NFC API in iOS
I found my way to your configuration for my project, I can't find in the official version of iOS11 and Xcode 9 on the card to read any information, I would like to ask you about, in a formal environment, your project has a special configuration of others?
I got the app running but my iPhone 7 Plus does not recognise tags. Tried all my tags on a Pixel Phone and they are all working. Even rebooting like @tinue suggested does not work for me. Your code looks fine to me. Hopefully it gets better in Beta 2.
On Android that was possible for a while, but if it is finally possible on iOS 11.
Note that some passports, like US, needs to be open for NFC chip to be read. Also, to read the data on passport's chip you need to provide input information found in MRZ zone.
Some apps, namely NFC Tools from wakdev and NFC NDEF READER https://itunes.apple.com/us/app/nfc-ndef-reader/id1286248064?mt=8 manage to show UID and TagType - see screenshots.
Any idea how to access these properties ?
CoreNFC seems to have not changed much in iOS 12, (I guess the rumors were wrong).
There is one change in the header files, a NSUserActivity.ndefMessagePayload
:
The NFC NDEF message with an Universial Link object that triggers the application launch.
See here.
Seems to indicate that you could register for your application to launch when a tag is scanned (from where???) with a specific NDEF message payload.
Anyone have any more information on this?
Hi!
I tried every tag I could grab nearby. They are elevator key, starbucks member card, subway ticket.
All failed... ๐ซ
All these tags are readable by Android and according to the app NFC-Tool
, many of them are NDEF formated.
The official NXP NFC tag -- NTAG213
I just ordered are still on the way. How about create a list collecting all tags workable with iOS? Thank you.
(sorry for not-directly-related issue!)
I couldn't find any resources online whether it is possible to use iPhone's RFID write capability (e.g. the capability that is used in apple pay)
anyone know if it is possible?
When i try to detect this(lb-m5215-1) RFID Tag it not detecting and throws an error as
"Required entitlement is missing"
Looks like RFID now is missing an unknown entitlement key in beta 3
Error reading RFID-Tag: Required entitlement is missing
Thanks for great example. But I have a question. ISO15693 API is private Apple API or it's just not presented yet?
Hi,
I only have a free developer account and can't get this project to compile. I always get errors about missing capabilities and entitlements.
The matrix here does not includes NFC (yet) :
As far as I know provisioning profiles can't be be managed from the developer portal with a free account, is that correct ? From what I understand it's managed automatically by Xcode.
Thanks
Ludovic
Feel free to check out https://github.com/jvk75/NFCNDEFParse
Small library that parses the NDEF messages ("well known types" as defined in NDEF specification) to usable objects. E.g. text type both locale and the payload string are in separate variable.
Early stage but usable. SP type coming soon...
These instructions mention a beta version of ti.nfc for ios, however the link provided does not seem to include the ios module. I apologize if this is the wrong place, but the projects appear to be related. Is the ti.nfc fork here the same beta version mentioned, or is there a better place to find this module?: https://github.com/hansemannn/ti.nfc/tree/2d14f18cf8898963a20eb809b968019cd16edee2/ios
Following similar instructions as iOS11-NFC-Example (using Entitlements.plist with the options mentioned), I've successfully built the module and the example Titanium app, but have run into some trouble and am looking for someplace to find some help. Thanks!
After the first NFC scan I get this error on the console when I try to scan a new tag agarin:
"Session is invalidated by user cancellation"
I believe it is because I have clicked on done or cancel before, is there a way to prevent that?
Crash App when Some NFC like print.
I don't have an Apple developer account, so I can't compile.
could it be that you need the decryption keys in order to even read the tag? For example, on US passports, the keys are derived from the passport data - name, birth date, etc.
I see in this Android NFC blog (see step 3) that they weren't able to read the data without possession of the keys: https://randomoracle.wordpress.com/2012/08/27/reading-the-us-passport-using-an-android-phone-overview/
I'm developing an application in which I want to get the NFC serial number and Identifier of a NFC tag. When I press a button, I want the application to find the UID and serial number of the NFC card. The only problem is that I have no idea how to get the UID and and serial number if that's possible on iOS. I m trying to get NFC identifier but i don't know how to get serial number of NFC Tag.
class ScanNFCTag: NFCTagReaderSessionDelegate {
import CoreNFC
var session: NFCTagReaderSession?
func scanNFCTag(sender: UIButton!) {
self.session = NFCTagReaderSession(pollingOption: .iso14443, delegate: self)
self.session?.alertMessage = "Hold Your Phone Near the NFC Tag"
self.session?.begin()
}
func tagReaderSessionDidBecomeActive(_ session: NFCTagReaderSession) {
print("Session Begin!")
}
func tagReaderSession(_ session: NFCTagReaderSession, didInvalidateWithError error: Error) {
print(error.localizedDescription)
}
func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
if tags.count > 1{
session.alertMessage = "More Than One Tag Detected, Please try again"
session.invalidate()
}
let tag = tags.first!
session.connect(to: tag) { (error) in
if nil != error{
session.invalidate(errorMessage: error?.localizedDescription ?? "")
}
if case let .miFare(sTag) = tag{
let UID = sTag.identifier.map{ String(format:"%.2hhx", $0)}.joined()
session.alertMessage = "Successfully linked tag to location"
session.invalidate()
DispatchQueue.main.async {
print("NFC Identifer = ", "\(UID)")
}
}
}
}
}
So, Here is the my code please let me know if i m doing wrong please correct me. Can someone please explain to me how to get serial number and UID of NFC tag,
Any help would be greatly appreciated.
Thanks in advance.
Hi, just wondering: Could you ever read any tag with your phone? I tried both your example and the one from Apple.
One tag on many that I have shows a "Produkt Erkannt" message, but then it doesn't actually read anything. All other tags time out when reading.
It's apparently very, very beta at this time, but I am wondering if you had more success.
Update: Even when the message "Produkt Erkannt" is shown, the "didDetectNDEFs" method is not being called. A few seconds after the message is shown, I am getting the "readerSessionInvalidationErrorUserCanceled".
Hi hansemannn,
Thx for your code sample for NFC.
I have tried to use it, but I 've got an error with UITableView.
Please, your help is welcome.
Normally, NFC is working fine with my setup (tried with another basic application, and it works fine).
Here below, log error message...
Main Thread Checker: UI API called on a background thread: -[UITableView reloadData]
PID: 439, TID: 69069, Thread name: (none), Queue name: com.apple.corenfc.readersession, QoS: 0
Backtrace:
4 NFC-Example 0x000000010277d43c _T011NFC_Example22NFCTableViewControllerC13readerSessionySo013NFCNDEFReaderG0C_SaySo14NFCNDEFMessageCG14didDetectNDEFstF + 2600
5 NFC-Example 0x000000010277d91c _T011NFC_Example22NFCTableViewControllerC13readerSessionySo013NFCNDEFReaderG0C_SaySo14NFCNDEFMessageCG14didDetectNDEFstFTo + 124
6 libdispatch.dylib 0x00000001032b1654 _dispatch_call_block_and_release + 24
7 libdispatch.dylib 0x00000001032b1614 _dispatch_client_callout + 16
8 libdispatch.dylib 0x00000001032c1008 _dispatch_queue_serial_drain + 716
9 libdispatch.dylib 0x00000001032b4e58 _dispatch_queue_invoke + 340
10 libdispatch.dylib 0x00000001032c21c4 _dispatch_root_queue_drain_deferred_wlh + 412
11 libdispatch.dylib 0x00000001032c97fc _dispatch_workloop_worker_thread + 868
12 libsystem_pthread.dylib 0x00000001a87e71e8 _pthread_wqthread + 924
13 libsystem_pthread.dylib 0x00000001a87e6e40 start_wqthread + 4
2017-06-12 11:12:32.207609+0200 NFC-Example[439:69069] [reports] Main Thread Checker: UI API called on a background thread: -[UITableView reloadData]
PID: 439, TID: 69069, Thread name: (none), Queue name: com.apple.corenfc.readersession, QoS: 0
Backtrace:
4 NFC-Example 0x000000010277d43c _T011NFC_Example22NFCTableViewControllerC13readerSessionySo013NFCNDEFReaderG0C_SaySo14NFCNDEFMessageCG14didDetectNDEFstF + 2600
5 NFC-Example 0x000000010277d91c _T011NFC_Example22NFCTableViewControllerC13readerSessionySo013NFCNDEFReaderG0C_SaySo14NFCNDEFMessageCG14didDetectNDEFstFTo + 124
6 libdispatch.dylib 0x00000001032b1654 _dispatch_call_block_and_release + 24
7 libdispatch.dylib 0x00000001032b1614 _dispatch_client_callout + 16
8 libdispatch.dylib 0x00000001032c1008 _dispatch_queue_serial_drain + 716
9 libdispatch.dylib 0x00000001032b4e58 _dispatch_queue_invoke + 340
10 libdispatch.dylib 0x00000001032c21c4 _dispatch_root_queue_drain_deferred_wlh + 412
11 libdispatch.dylib 0x00000001032c97fc _dispatch_workloop_worker_thread + 868
12 libsystem_pthread.dylib 0x00000001a87e71e8 _pthread_wqthread + 924
13 libsystem_pthread.dylib 0x00000001a87e6e40 start_wqthread + 4
2017-06-12 11:12:44.163074+0200 NFC-Example[439:69069] *** Assertion failure in -[UITableView _dequeueReusableCellWithIdentifier:forIndexPath:usingPresentationValues:], /BuildRoot/Library/Caches/com.apple.xbs/Sources/UIKit/UIKit-3678.13/UITableView.m:7518
2017-06-12 11:12:44.170954+0200 NFC-Example[439:69069] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'unable to dequeue a cell with identifier NFCTableCell - must register a nib or a class for the identifier or connect a prototype cell in a storyboard'
*** First throw call stack:
(0x184ee04e8 0x1a7850528 0x184ee03bc 0x186b5dc24 0x18c01c7cc 0x18be654e8 0x10277c238 0x10277c660 0x18c02c844 0x18c02cd5c 0x18c00e9c4 0x18bdd26a0 0x18bcfe4f0 0x18b21aa84 0x18b20ed70 0x18b20ec2c 0x18b18588c 0x18b1acae4 0x18b1ace7c 0x1a87e7898 0x1a87e75e8 0x1a87e7380 0x1a87e6e40)
libc++abi.dylib: terminating with uncaught exception of type NSException
Hi I have a PN532 NFCNDEFTag chip connected to an Arduino Uno, the chip should send a ndef message to the phone, everything works good in Android while this app seems not to see the chip.
The app works with a card but not with the chip?
Do you know why?
I need credit card information. Can I get it if it is suitable for contactless payment (NFC)? -> if okey, What do I need to get Credit Card Information?
Always prompt "The NFC-session is not ready so far, try again!"
xcode9 beta3
iPhone7plus
iOS11 beta3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.