Search code examples
iosswiftuisilicon

Apple silicon Macs support issue because of SKOverlay.AppConfiguration


My app uses appStoreOverlay to show recommended app, but error occurs when submit to app store.

ITMS-90863: Apple silicon Macs support issue - The app uses symbols that are not present on Mac:
/System/Library/Frameworks/_StoreKit_SwiftUI.framework/_StoreKit_SwiftUI
_$s7SwiftUI4ViewP010_StoreKit_aB0F03appD7Overlay11isPresented13configurationQrAB7BindingVySbG_So22SKOverlayConfigurationCyctRQOMQ

I think SKOverlay.AppConfiguration is not present on silicon Mac. According to 'Building a Universal macOS Binary', I add some macro and the code run in iOS only, but error still exist. Any suggestions?

#if !targetEnvironment(macCatalyst) && os(iOS)
Button(action: { showRecommendedApp.toggle() }) { Text("App recommended".localized)  
    .appStoreOverlay(isPresented: $showRecommendedApp) {
        SKOverlay.AppConfiguration(appIdentifier: "12345", position: .bottom)
    }
#endif

Solution

  • M1 Macs can run iOS binaries directly, they don't need a Mac Catalyst build.

    You can't use a #if to test for M1 at compile time since it is the same binary running on iOS and M1 Macs.

    You can use a run time check of isiOSAppOnMac.

    if !ProcessInfo.processInfo.isiOSAppOnMac {
        Button ...
    }
    

    You will still get the warning but you know that it will be handled correctly at runtime.