question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use of undelcared identifier 'UIUserInterfaceIdiomMac' [iOS]

See original GitHub issue

Summary

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 https://github.com/react-native-device-info/react-native-device-info/pull/1137

Version master https://github.com/react-native-device-info/react-native-device-info/commit/9f286d724be1041ec4816c677ff2fff713115f07
Affected OS iOS
Xcode Version 11.7
Variant debug
OS Version ?

Current behavior

Failed to build

Expected behavior

Succeed to build

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:18

github_iconTop GitHub Comments

3reactions
todoronecommented, Jan 11, 2021

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!

1reaction
mikehardycommented, Jan 11, 2021

Interesting, for me was the opposite, I needed Xcode 12 immediately in order to continue submitting to App Store because we were touching APIs that had ios14-specific requirements. But that’s software - everyone’s situation is different. Good luck with your project!

Read more comments on GitHub >

github_iconTop Results From Across the Web

"use of undeclared identifier" error in Objective-C
You need to declare navController outside the if statement: - (BOOL)application:(UIApplication *)application ...
Read more >
Use of undeclared identifier | Apple Developer Forums
I'm working on an objective c based macos project for years, containing numerous Objective C classes. Someone any idea?
Read more >
Ios – “use of undeclared identifier” error in Objective-C
I have been following a tutorial about parsing json with Xcode but have come across issues that i cant resolve. I suspect they...
Read more >
[Solved]-How to determine device type from Swift? (OS X or iOS)-swift
I you are using "Scale interface to Match iPad, you cannot use UIDevice.current.userInterfaceIdiom , because it will return an .iPad value.
Read more >
Detect current device with UIUserInterfaceIdiom in Swift
To detect current device with iOS/Swift we can use UserInterfaceIdiom. It is an enum in swift, which tells which device is being used....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found