Search code examples
iosxcodemacospush-notificationuikitformac

"UserNotificationsUI" is not available when building for UIKit for Mac error


  • My app has Service & Content Extension Notifications targets for supporting Rich Remote Notifications which work as expected on iPad/iPhone iOS 13 & below
  • I have installed Xcode 11-beta & macOS Catalina 10.15-beta
  • On building with the new UIKitForMac I get the following error -
"UserNotificationsUI" is not available when building for UIKit for
Mac. You may need to restrict the platforms for which this framework
should be linked in the target editor.
  • First tried adding #if canImport() ... #endif around instances of UserNotificationsUI which didn't work
  • Then removed the Extension Targets which is also not working.

Anyone facing a similar issue?

Xcode11 screenshot


Solution

  • A closed source Third party framework that I was using had UserNotificationsUI linked.

    The build error was because UIKitForMac doesn't support Mobile specific frameworks like UserNotifications which is the correct behaviour.

    Removing the Third Party dependency resolved the issue for me.