---
title: "postNotificationName(_:object:userInfo:options:)"
framework: foundation
role: symbol
role_heading: Instance Method
path: "foundation/distributednotificationcenter/postnotificationname(_:object:userinfo:options:)"
---

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

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

## Declaration

```swift
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

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.

## See Also

### Posting Notifications

- [post(name:object:)](foundation/distributednotificationcenter/post(name:object:).md)
- [post(name:object:userInfo:)](foundation/distributednotificationcenter/post(name:object:userinfo:).md)
- [postNotificationName(_:object:userInfo:deliverImmediately:)](foundation/distributednotificationcenter/postnotificationname(_:object:userinfo:deliverimmediately:).md)
