Swift - App Store Connect Version can't detect Catalyst Environment

Viewed 151

I've developed an iOS App and want to bring it to macOS with Catalyst. Everything works out fine, I could optimise the layout for the mac by using following code:

extension UIDevice {
    var type: DeviceType {
        #if targetEnvironment(macCatalyst)
            return .mac
        #else
        switch UIDevice.current.userInterfaceIdiom
        {
        case .phone:
            return .phone
        case .pad:
            return .pad
        default:
            return .phone
        }
        #endif
    }
} 

I use it primarily to show different slides within a CollectionView.

On my local Macbook 15 (2017, Big Sur 11.0.1) everything works as it should. But when publishing the App to the App Store, it gets rejected because it shows the iPad - layout.

Has/ had anyone a similar problem? Or is it possible that I mad a mistake when archiving the build? (Destination: Any Mac (Apple Silicon, Intel) -> Product -> Archive)

Thank you very much!

1 Answers

I could find an answer to the question. The code wasn't the problem, everything worked out well. There was a mistake while building the archive for the mac:

So if anyone should have the same problem in the future, when archiving your build for mac:

Don't use "Any Mac (Apple Silicon, Intel)" as run destination.

Use "My Mac" as run destination.

For more see the documentation: https://help.apple.com/xcode/mac/current/#/deva1159eef6

Related