In iOS13 beta version. when I tried use the NFCISO15693Tag api
customCommandWithRequestFlag:customCommandCode:customRequestParameters:completionHandler:
send customCommand code to the tag ,
I got the error:
-[NFCTagReaderSession transceive:tagUpdate:error:]:706 Error Domain=NFCError Code=2 "Missing required entitlement" UserInfo={NSLocalizedDescription=Missing required entitlement}
I have tried:
1, Reconfig the Privacy of NFC.
2, Add the config in my info.plist
<key>com.apple.developer.nfc.readersession.felica.systemcodes</key>
<array>
<string>12FC</string>
</array>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>D2760000850101</string>
</array>
But , none of them work for me .
The following is my source code:
func tagReaderSession(_ session: NFCTagReaderSession, didDetect tags: [NFCTag]) {
if let st = tags.first {
session.connect(to: st) { (error) in
if error != nil {
session.invalidate(errorMessage: "Connection error. Please try again.")
return
}
if case let .iso15693(type5Tag) = st {
print(type5Tag.identifier.toString())
print(type5Tag.icSerialNumber.toString())
print(type5Tag.isAvailable)
type5Tag.select(requestFlags: [.address, .highDataRate]) { (selectError) in
print("selectError")
print(selectError)
}
type5Tag.customCommand(requestFlags: [.highDataRate, .address], customCommandCode: 0xB4, customRequestParameters: Data([0x02])) { (data, error) in
print("custom command: get random number")
print(data.toString())
print(error)
}
}
}
}
Actually, I get the following error:
-[NFCTagReaderSession transceive:tagUpdate:error:]:706 Error Domain=NFCError Code=2 "Missing required entitlement" UserInfo={NSLocalizedDescription=Missing required entitlement}
expect 4 bytes random number.