<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.0.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/FileHandle/waitForDataInBackgroundAndNotify()",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSFileHandle(im)waitForDataInBackgroundAndNotify"
  },
  "title" : "waitForDataInBackgroundAndNotify()"
}
-->

# waitForDataInBackgroundAndNotify()

Asynchronously checks to see if data is available.

```
func waitForDataInBackgroundAndNotify()
```

## Discussion

When the data becomes available, this method posts a [`NSFileHandleDataAvailable`](/documentation/Foundation/NSNotification/Name-swift.struct/NSFileHandleDataAvailable) notification on the current thread.

You must call this method from a thread that has an active run loop.

---

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)