iOS Guides | Samples

MonoTouch.UIKit.UIUserNotificationSettings Class

Permissions for local notifications, as controlled by the application user.

See Also: UIUserNotificationSettings


[MonoTouch.Foundation.Register("UIUserNotificationSettings", true)]
[MonoTouch.ObjCRuntime.Deprecated(MonoTouch.ObjCRuntime.PlatformName.iOS, 10, 0, MonoTouch.ObjCRuntime.PlatformArchitecture.None, "Soft deprecated in iOS 10, use UserNotifications.UNNotificationSettings")]
[MonoTouch.ObjCRuntime.Introduced(MonoTouch.ObjCRuntime.PlatformName.iOS, 8, 0, MonoTouch.ObjCRuntime.PlatformArchitecture.None, null)]
[MonoTouch.ObjCRuntime.Unavailable(MonoTouch.ObjCRuntime.PlatformName.WatchOS, MonoTouch.ObjCRuntime.PlatformArchitecture.All, null)]
[MonoTouch.ObjCRuntime.Unavailable(MonoTouch.ObjCRuntime.PlatformName.TvOS, MonoTouch.ObjCRuntime.PlatformArchitecture.All, null)]
public class UIUserNotificationSettings : NSObject, INSCopying, INSSecureCoding, IDisposable


Starting with iOS 8, users must give explicit permission for apps that wish to respond to local notifications.

Prior to attempting to send local notifications, devs must request permission from the application user to manipulate the app icon badge, play a sound, or display an alert (see UIUserNotificationType). Typically, this is done in the UIAppDelegate.FinishedLaunching overridden method:

F# Example

    ||| UIUserNotificationType.Badge 
    ||| UIUserNotificationType.Sound, 
new NSSet())
|> UIApplication.SharedApplication.RegisterUserNotificationSettings

C# Example

var settings = UIUserNotificationSettings.GetSettingsForTypes(
    | UIUserNotificationType.Badge 
    | UIUserNotificationType.Sound, 
    new NSSet());

The user is presented with a permissions dialog. Once they have made their choices, the system calls UIAppDelegate.DidRegisterUserNotificationSettings.

The current permissions can be read with UIApplication.CurrentUserNotificationSettings.

Related content


Namespace: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions:

The members of MonoTouch.UIKit.UIUserNotificationSettings are listed below.

See Also: NSObject

Public Constructors

Default constructor, initializes a new instance of this class.
A constructor that initializes the object from the data stored in the unarchiver object.
Constructor to call on derived classes to skip initialization and merely allocate the object.
A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

Public Properties

CategoriesNSSet. Registered groups of actions for the app. (read-only)
ClassHandleIntPtr. The handle for this class.
TypesUIUserNotificationType. Notification types that the app is permitted to use.

Public Methods

Copy(NSZone) : NSObject
Performs a copy of the underlying Objective-C object.
GetSettingsForTypes(UIUserNotificationType, NSSet) : UIUserNotificationSettings
Gets settings that can be used to register the requested notification and action types.