Search code examples
iosxcodeios10today-extensionios10-today-widget

Disabling today widget on IOS10 devices


I have an existing app and i want to release a version to support IOS10 devices. The problem is that my app today widget not is supporting the new today view in IOS10 and i want to disable the today widget to all IOS10 users. It it possible? I already tried to set to today widget to Base SDK of 9.3 from XCode build settings and it didn't work Thanks!


Solution

  • You can show/hide the widget from within you Containing App based on your requirement.

        if #available(iOSApplicationExtension 10.0, *)
        {
            DispatchQueue.main.async(execute: {
                NCWidgetController.widgetController().setHasContent(false, forWidgetWithBundleIdentifier: "YourWidgetBundleIdentifier")
            })
        }