UIUserNotificationSettings Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Permissions for local notifications, as controlled by the application user.
[Foundation.Register("UIUserNotificationSettings", true)]
public class UIUserNotificationSettings : Foundation.NSObject, Foundation.INSCopying, Foundation.INSSecureCoding, IDisposable
[<Foundation.Register("UIUserNotificationSettings", true)>]
type UIUserNotificationSettings = class
inherit NSObject
interface INSCoding
interface INativeObject
interface IDisposable
interface INSCopying
interface INSSecureCoding
- Inheritance
- Attributes
- Implements
Remarks
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 FinishedLaunching(IUIApplicationDelegate, UIApplication, NSDictionary) overridden method:
UIUserNotificationSettings.GetSettingsForTypes(
UIUserNotificationType.Alert
||| UIUserNotificationType.Badge
||| UIUserNotificationType.Sound,
new NSSet())
|> UIApplication.SharedApplication.RegisterUserNotificationSettings
var settings = UIUserNotificationSettings.GetSettingsForTypes(
UIUserNotificationType.Alert
| UIUserNotificationType.Badge
| UIUserNotificationType.Sound,
new NSSet());
UIApplication.SharedApplication.RegisterUserNotificationSettings(settings);
The user is presented with a permissions dialog. Once they have made their choices, the system calls DidRegisterUserNotificationSettings(IUIApplicationDelegate, UIApplication, UIUserNotificationSettings).
The current permissions can be read with CurrentUserNotificationSettings.
Constructors
| Name | Description |
|---|---|
| UIUserNotificationSettings() |
Creates a new UIUserNotificationSettings with default values. |
| UIUserNotificationSettings(NativeHandle) |
A constructor used when creating managed representations of unmanaged objects. Called by the runtime. |
| UIUserNotificationSettings(NSCoder) |
A constructor that initializes the object from the data stored in the unarchiver object. |
| UIUserNotificationSettings(NSObjectFlag) |
Constructor to call on derived classes to skip initialization and merely allocate the object. |
Properties
| Name | Description |
|---|---|
| AccessibilityAttributedUserInputLabels | (Inherited from NSObject) |
| AccessibilityRespondsToUserInteraction | (Inherited from NSObject) |
| AccessibilityTextualContext | (Inherited from NSObject) |
| AccessibilityUserInputLabels | (Inherited from NSObject) |
| Categories | |
| Class | (Inherited from NSObject) |
| ClassHandle |
The Objective-C class handle for this class. |
| DebugDescription | (Inherited from NSObject) |
| Description | (Inherited from NSObject) |
| Handle |
Handle (pointer) to the unmanaged object representation. (Inherited from NSObject) |
| IsDirectBinding | (Inherited from NSObject) |
| IsProxy | (Inherited from NSObject) |
| RetainCount | (Inherited from NSObject) |
| Self | (Inherited from NSObject) |
| Superclass | (Inherited from NSObject) |
| SuperHandle |
Handle used to represent the methods in the base class for this NSObject. (Inherited from NSObject) |
| Types | |
| Zone | (Inherited from NSObject) |