<!--
{
  "availability" : [
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/DistributedNotificationCenter/postNotificationName(_:object:userInfo:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSDistributedNotificationCenter(im)postNotificationName:object:userInfo:options:"
  },
  "title" : "postNotificationName(_:object:userInfo:options:)"
}
-->

# postNotificationName(_:object:userInfo:options:)

Creates a notification with information, and posts it to the receiver.

```
func postNotificationName(_ name: NSNotification.Name, object: String?, userInfo: [AnyHashable : Any]? = nil, options: DistributedNotificationCenter.Options = [])
```

## Parameters

`name`

Name of the notification to post. Must not be `nil`.

`object`

Sender of the notification. May be `nil`.

`userInfo`

Dictionary containing additional information. May be `nil`.
  
  > Important:
  > Sandboxed apps can send notifications only if they do not contain a dictionary. If the sending application is in an App Sandbox, `userInfo` *must* be `nil`.

`options`

Specifies how the notification is posted to the task and when to deliver it to its observers. See `Notification Posting Behavior` for details.

## Discussion

The `userInfo` dictionary is serialized as a property list, so it can be passed to another task. In the receiving task, it is deserialized back into a dictionary. This serialization imposes some restrictions on the objects that can be placed in the `userInfo` dictionary. See XML Property Lists for details.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)