5

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!

  • 2
    You do know that userInterfaceIdiom also has a mac value, right? https://developer.apple.com/documentation/uikit/uiuserinterfaceidiom/mac Why don't you use that? – idmean Jan 23 '21 at 07:00
  • Hi, yes you are right! But unfortunately the userInterfaceIdiom for mac needs iOS 14 / Mac Catalyst 14 and my minimum requirement for the iOS - App is iOS 13, so I need a workaround for that. But I cloud solve my problem: It wasn't an error in the code, it was a mistake while building the archive. But thank you very much! – Christoph Schuierer Jan 23 '21 at 09:50

1 Answers1

0

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