Hello
Is it impossible to install an app to both iPhone and iPad when the app use NFC? The app, I'm working on, use NFC on iPhone but not on iPad. The app program code checks iPhone or iPad and use NFC only on iPhone.
However, TestFlight and App Store show "No Compatible Hardware" on iPad and can't download. It works as expected on iPhone. Target Device is set both iPhone and iPad, the configuration is TARGETED_DEVICE_FAMILY = "1,2"
According to Required Device Capabilities, iPad doesn't support NFC https://developer.apple.com/support/required-device-capabilities/#ipad-devices
The app has UIRequiredDeviceCapabilities = nfc configuration only for iPhone. But is it block installing to iPad? If so how to fix this issue?
Thanks in advance.
It is possible to have a single binary that installs on both. If you want the app to also run on devices with no NFC, the solution is to use weak linking, so the system does not attempt to load the NFC framework/libraries.
What you need to do is weak link the CoreNFC framework manually in project settings, and then avoid using it if the app is not running on a supported device (check for iPad).
To do this, you need to do the following:
- in your project Build Phases, the "Link Binary With Libraries” section, add the CoreNFC.framework, and then mark it as Optional. This will prevent the app from crashing at launch.
- the next thing you need to handle is to avoid problematic behavior at App Review or in case a user installs the app on an iPad. For that, you could do a check of the UIDevice.current.model value and not engage any features of your app that would require the use of CoreNFC features.
Keep in mind, that App Review will require the app to have some adequate functionality, while not using NFC, on an iPad.
Argun Tekant / DTS Engineer / Core Technologies