Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
295 views
in Technique[技术] by (71.8m points)

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

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!

question from:https://stackoverflow.com/questions/65851703/swift-app-store-connect-version-cant-detect-catalyst-environment

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...