How to read different type of NFC Tag in NFCTagReaderSession in iOS 13?
Yes.
<key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
<array>
<string>12FC</string>
</array>
I don't remember the meaning of 12FC value, but you should have it if you try to read . iso18092
.
I also have the following values for 7816 taken from https://www.eftlab.com/knowledge-base/211-emv-aid-rid-pix/:
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>A0000002471001</string>
<string>A000000003101001</string>
<string>A000000003101002</string>
<string>A0000000041010</string>
<string>A0000000042010</string>
<string>A0000000044010</string>
<string>44464D46412E44466172653234313031</string>
<string>D2760000850100</string>
<string>D2760000850101</string>
<string>00000000000000</string>
</array>
how to get icManufacturerCode of NFC tag in iOS
The issue for iOS11 are related to the signature of classes and protocols on the part of Apple (protocol NFCTag
have become enum for iOS13, if I don't confuse). However, you can use this code and it should work for all versions of iOS11+
extension YourViewController: __NFCReaderSessionDelegate {
func readerSessionDidBecomeActive(_ session: NFCReaderSession) {
}
func readerSession(_ session: NFCReaderSession, didInvalidateWithError error: Error) {
}
func readerSession(_ session: NFCReaderSession, didDetect tags: [__NFCTag]) {
for tag in tags {
let rfidTag = tag as! NFCISO15693Tag
print("- Is available: \(rfidTag.isAvailable)")
print("- Type: \(rfidTag.type)")
print("- IC Manufacturer Code: \(rfidTag.icManufacturerCode)")
print("- IC Serial Number: \(rfidTag.icSerialNumber)")
print("- Identifier: \(rfidTag.identifier)")
}
}
}
There are 2 required methods and one optional (it's from Obj-C), just to get icManufacturerCode
.
According to documentation of Apple
use an instance of NFCNDEFReaderSession or NFCTagReaderSession. Only
one reader session of any type can be active in the system at a time
Tag connection lost error when reading a Mifare Ultralight NFC tag on iOS 13
According to the API (CoreNFC/NFCMiFareTag) the CRC will be calculated and inserted automatically. So in your case you only need to send [0x30, 0x04]
to read page 4 to 7, the read command 0x30
will read 4 pages you will get 16 bytes.
/**
* @method sendMiFareCommand:completionHandler:
*
* @param command The complete MiFare command. CRC bytes are calculated and inserted automatically to the provided packet data frame.
* @param completionHandler Completion handler called when the operation is completed. error is nil if operation succeeds. A @link NFCErrorDomain @link/ error
* is returned when there is a communication issue with the tag. Successfully read data blocks will be returned from the NSData object.
*
* @discussion Send native MIFARE command to a tag. Support MIFARE UltraLight, Plus, and DESFire products.
* Crypto1 protocol is not supported. Command chainning is handled internally by the method and the full response composed of the
* individual fragment is returned in the completion handler.
*/
@available(iOS 13.0, *)
func sendMiFareCommand(commandPacket command: Data, completionHandler: @escaping (Data, Error?) -> Void)
Related Topics
Combining Scenekit and Spritekit in a Single Screen
Swift: Method Overriding in Parameterized Class
Remove Cell When Button Pressed Inside Cell Customtableviewcell
Allow Line Editing When Reading Input from The Command Line
Include Inheritance Constraint in Swift Generic Types
Realm Data Insertion Took Over 7Mins for Big Size JSON
Swiftui Tabview with List Not Refreshing After Objected Deleted From/Added to Core Data
Alamofire Nonblocking Connection
Uicollectionview Selected Cells Issue
How to Download Video Urlstring from Firebase Database Not Storage in Swift
Prepareforsegue from a UIbutton in a Custom Prototype Cell
How to Read a File from The Filesystem in a Swift Command Line App
Swift Framework with Opencv Dynamic Framework, Library Not Loaded
Wkwebview Problems in Macos Mojave
Swift Displaying The Time or Date Based on Timestamp
How to Create a UIprintpaper to Test UIprintinteractioncontrollerdelegate