Hello, we're having problems running the sample code for HCE https://developer.apple.com/documentation/corenfc/cardsession/
We have the necessary HCE Entitlements in place. Everything is configured according to the guidelines in both the entitlements and info.plist files. Unfortunately, when trying to execute the code, the app crashes and the state is as follows:
NFCReaderSession.readingAvailable = true
CardSession.isSupported = true
And the crash happens after executing CardSession.isEligible
With
CoreNFC/NFCCardSession.swift:451: Fatal error: Missing required entitlement
The app runs on iOS 18.0 (22A5338b). Our account is registered in Bulgaria, which is part of the EEA, and the tests are run in Bulgaria.
Hi, I've found a solution thanks to the Apple developer help team. My AID was wrong. Here is the guidance:
Getting this error at .isEligible indicates that while you have the entitlements assigned for your app, the AIDs are invalid.
The AIDs you declare must be valid according to the ISO7816 Specification, a minimum of 5 bytes (10 hex digits, a maximum of 16 bytes (32 hex digits), and must be an even number of digits.
Therefore your AIDs, containing non hex characters, are not valid, causing the entitlement error.
So, you will need to find out the full hex string / bytes array value of your intended AID. That will be the value that you use in the ISO7816 SELECT command as the APDU payload
code-block