<!--
{
  "availability" : [
    "macOS: 10.12.4 -"
  ],
  "documentType" : "symbol",
  "framework" : "SafariServices",
  "identifier" : "/documentation/SafariServices/SFSafariExtensionHandling/messageReceivedFromContainingApp(withName:userInfo:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Safari Services"
    ],
    "preciseIdentifier" : "c:objc(pl)SFSafariExtensionHandling(im)messageReceivedFromContainingAppWithName:userInfo:"
  },
  "title" : "messageReceivedFromContainingApp(withName:userInfo:)"
}
-->

# messageReceivedFromContainingApp(withName:userInfo:)

A method the system calls when the extension receives a message from the extension’s containing app.

```
optional func messageReceivedFromContainingApp(withName messageName: String, userInfo: [String : Any]? = nil)
```

## Parameters

`messageName`

A string that identifies the message.

`userInfo`

Optional message content.

## See Also

[`class func dispatchMessage(withName: String, toExtensionWithIdentifier: String, userInfo: [String : Any]?, completionHandler: (((any Error)?) -> Void)?)`](/documentation/SafariServices/SFSafariApplication/dispatchMessage(withName:toExtensionWithIdentifier:userInfo:completionHandler:))

Sends a message to a Safari app extension, launching Safari if necessary.



---

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)