Use of undelcared identifier ‘UIUserInterfaceIdiomMac’ [iOS]


I’m facing Intent Redirection issue that discussed here. Someone has created PR to resolve that issue, hopefully. But, that PR had not been released as official release version. So, I point react-native-device-info on package.json to master branch of this repo to get that changes.

Unfortunately, I got this error below when I built my app.

Duplicate case value 'UIUserInterfaceIdiomPad'
Use of undeclared identifier 'UIUserInterfaceIdiomMac'; did you mean 'UIUserInterfaceIdiomPad'?
Replace 'UIUserInterfaceIdiomMac' with 'UIUserInterfaceIdiomPad'

on RNDeviceInfo.m

- (DeviceType) getDeviceType
    switch ([[UIDevice currentDevice] userInterfaceIdiom]) {
        case UIUserInterfaceIdiomPhone: return DeviceTypeHandset;
        case UIUserInterfaceIdiomPad: return TARGET_OS_MACCATALYST ? DeviceTypeDesktop : DeviceTypeTablet;
        case UIUserInterfaceIdiomTV: return DeviceTypeTv;
        case UIUserInterfaceIdiomMac: return DeviceTypeDesktop;
        default: return DeviceTypeUnknown;

This issue didn’t appear on 7.3.1 version. Seems, it was related to this changes #1137

Version master 9f286d7
Affected OS iOS
Xcode Version 11.7
Variant debug
OS Version ?

Current behavior

Failed to build

Expected behavior

Succeed to build

1 possible answer(s) on “Use of undelcared identifier ‘UIUserInterfaceIdiomMac’ [iOS]

  1. xcode 12 is not compatible with react native?

    I did not say exactly this, probably RN is compatible with XCode 12, but not all dependencies are up to date. When i tried to migrate my production project month ago there were couple of annoying XCode-related issues with compilation to different targets(XC 12 is not backward compatible) and I almost sure not all of them are sorted out. So my point was that requirement to upgrade to XC 12 is breaking change for some not-hello-world projects.

    Thanks once again for prompt reaction!