<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/NSExtensionRequestHandling/beginRequest(with:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(pl)NSExtensionRequestHandling(im)beginRequestWithExtensionContext:"
  },
  "title" : "beginRequest(with:)"
}
-->

# beginRequest(with:)

Tells the extension to prepare for a host app’s request.

```
func beginRequest(with context: NSExtensionContext)
```

## Parameters

`context`

An [`NSExtensionContext`](/documentation/Foundation/NSExtensionContext) object that represents the context in which the host app makes the request. Typically, the context contains data that the extension can work on.

## Discussion

An extension prepares for a host app’s request by getting the context passed in this method and requesting related data items, if appropriate. This method is received after the extension is initialized, but before the principal object is asked to do anything with the context. For example, if the principal object is a view controller, it receives this message before <doc://com.apple.documentation/documentation/UIKit/UIViewController/loadView()> is called. After an extension receives this message, the <doc://com.apple.documentation/documentation/UIKit/UIViewController/extensionContext> property of the view controller returns a non`nil` value.

If your subclass conforms to this protocol and overrides `beginRequestWithExtensionContext:`, the subclass is expected to call `[super beginRequestWithExtensionContext:]`.

## See Also

  [App Extension Programming Guide](https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/index.html#//apple_ref/doc/uid/TP40014214)



---

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)