CoreNFC: Sending Custom Commands using NFCISO15693Tag protocol

I'm trying to use iOS 13's new CoreNFC capabilities to read\write data to an ISO15693 compatible chip. My app includes the NFC Tag Reader Session Formats Entitlements:


<key>com.apple.developer.nfc.readersession.formats</key>
<array>
  <string>NDEF</string>
  <string>TAG</string>
</array>


The NFCTagReaderSessionDelegate receives an object that conforms the NFCISO15693Tag protocol and I have been successfully called readSingleBlock function to read dtat from the Tag. But whenever I call customCommand to send a proprietary command for reading data from the Tag, I get the following error: "Error Domain=NFCError Code=2 "Missing required entitlement" UserInfo={NSLocalizedDescription=Missing required entitlement}".


Does anyone has managed to get this work? What are the missing entitlements needed to use customCommand function?

Answered by Behnaz in 373048022

Ok, so for me iOS 13 beta 4 has solved the issue with the"Missing required entitlement".

Now, I can call the customCommand method without any error...

Same issue found with iso15693...no idea how to solve it !!

customCommands does not work..😢


Standard commands as defined in 15693-3 standard work fine.


In addition, many extended commands are missing : As defined into the 15693-4 standard, the following extended commands are not supported into coreNFC iOS13 beta (Is this an oversight?) :


'34' Optional Yes Yes Yes Extended write multiple blocks

'35' Optional No No Authenticate

'36' Optional Yes Yes KeyUpdate

'37' Optional No No AuthComm crypto format indicator

'38' Optional No No SecureComm crypto format indicator

'39' Optional No No Challenge

'3A' Optional No Yes No ReadBuffer

'3B' Optional No No No Extended get system information

'3C' Optional No No No Extended get multiple block security

I'm having the exact same issue. Standard ISO15693 operations, such as read multiple blocks, is working but customCommandWithRequestFlags fails with "Missing required entitlements". Based on the WWDC session, I would expect this to work. I think this should be reported as a bug.

Thx for confirmation...

I logged a "feedback assistant" ticket 1 week ago...but no answer yet !!!

I did the same, reported a feedback and got nothing at all... Have you had any response yet, or have you been met with a wall of slience? Really annoying as it's public API with no warning of it in either the docs or the WWDC session video - perhaps it may change in beta 3 - here's hoping

Just checked the beta 3: same error message!

It is indeed very frustrating... NFC has long been held back by Apple not supporting it, but now with iOS 13 and the latest announcements we are eager to see this up and running.

I have also reported this error to the feedback center and I am waiting for a response.

Thanks for checking so quickly Behnaz, it was on my list of things to do this evening as I've not got to downloading Xcode beta 3. Hopefully Apple respond to one of us soon...

no feedback yet !!! :-(

I reported this problem using the 'Feedback Assistant' .


The report status has just changed to :

Resolution:Potential fix identified - For a future OS update


I hope that this is going to be in the coming beta update ...

Great to hear! Thanks for the update, will keep an eye on the next release notes - guessing the next beta will come out next week....

I use the iOS 13 beta3 got the same error.
Hope apple fix it before iOS13 release

I have tried iOS 13 beta4 .

Got the same error.


-[NFCTagReaderSession transceive:tagUpdate:error:]:708 Error Domain=NFCError Code=2 "Missing required entitlement" UserInfo={NSLocalizedDescription=Missing required entitlement}

Accepted Answer

Ok, so for me iOS 13 beta 4 has solved the issue with the"Missing required entitlement".

Now, I can call the customCommand method without any error...

Hi Behnaz,

What did you do to get this to work? I'm on beta 5 and just tried this out, still seem to be getting the same thing... could you share what command you used? Have you tried in the latest beta to ensure the functionality hasn't changed?

Hi d.Knowles,


Yes I do have the latest (beta 5 build 17A5547d), and XCode 11.0 beta 3.


When do you get the error ? At the start of the session or when you actually call the customcommand function?


If you are getting the error before the end of tag connection, you should check again your App profile, capabilities, .plist and .entitlements file and that you ar embedding the corenfc.framework library ... ( see Core NFC Enhancements - WWDC 2019 - Videos - Apple Developer )


If the connection goes well but you still get the error on customcommand, the problem should be solved with installing beta 4 or later and I did actually get the confirmation from the 'Feedback Assitant'.


I just needed the customcommand function as I am using the NFCISO15693Tag to communicate with and ST25DV Tag. I have not tested the other functions.

Thanks for the reply.

It happens as soon as I call customCommand. I don't have an issue getting a reader session set up, or reading data from the tag using:


getSystemInfo(requestFlags:completionHandler:)

readMultipleBlocks(requestFlags:blockRange:completionHandler:)

writeAFI(requestFlags:afi:completionHandler:)

and a few others.


It's as soon as I hit this method:

customCommand(requestFlags:customCommandCode:customRequestParameters:completionHandler:)


Would you mind sharing the commands you're using? I've tried A1 -> A5 and get the missing entitlements error.


I've double checked my entitlements and have both TAG and NDEF for the com.apple.developer.nfc.reader entitlement.. Using beta 5 of both iOS and Xcode on an iPhone 8.

I am using swift language and testing on an iPhoneXS. Here is an example of customCommand usage:


tag.customCommand(requestFlags: [.highDataRate],
       customCommandCode: 0xAE,
       customRequestParameters: Data(bytes: [UInt8(0x0D), UInt8(0x01)], count: 2),
       completionHandler: { (response: Data, error: Error?) in
            //completion handler
            })

Looks very similar to what i'm doing, although I'm using the addressed flag, and 0xA5 with no data as the request doesn't require any params.


Perhaps I'll have a play later with a few combinations and take out the addressed flag. Although the tags I'm using don't implement 0xAE, I'll try issuing that command - I'd expect to get an error other than missing entitlement if that's the case.


Is this the only command you've tried?

I was wondering if your ticket has changed the answer yet?
I am stuck because I can't send customCommand 0x35 to Authenticate a chip using the AES Crypto module inside of it.
I hate to say it, but android's NFC framework has a command called

public byte[] transceive (byte[] data)

"Send raw NFC-A commands to the tag and receive the response."
Developers can completely create their own blocks of data to send to the tag and receive the answer in the same little function.
That looks so much better than getting "Custom command code must be between 0xA0 to 0xDF inclusively" when trying to send a "customCommand" 0x35 that is so basic to NFC Tag security.
I hope they allow developers to implement this, and not leave us behind android like that.

I confirm that iOS13 coreNFC custom comand does not work with ".address" request flag !!! . Otherwise you will get an "entitlement" error ??!!!!
Hope it will be fixed in Official release.

This seems to still be happening with iOS 13.1.2. The only ISO15693 command where Apple provided much documentation is readSingleBlockWithRequestFlags. Those docs say that RequestFlagAddress is enabled by default and that the OS will include the tag's identifier with the command. It may be the case that customCommand does that as well, which is why it rejects the attempt to include RequestFlagAddress manually. I don't have a way to verify this -- does anyone have an NFC card emulator or some other way to snoop the NFC traffic?

Is there any reference that .address command does not work? Is there any workaround possible?

CoreNFC: Sending Custom Commands using NFCISO15693Tag protocol
 
 
Q