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

# compileAndReturnError(_:)

Compiles the receiver, if it is not already compiled.

```
func compileAndReturnError(_ errorInfo: AutoreleasingUnsafeMutablePointer<NSDictionary?>?) -> Bool
```

## Parameters

`errorInfo`

On return, if an error occurs, a pointer to an error information dictionary.

## Return Value

<doc://com.apple.documentation/documentation/Swift/true> for success or if the script was already compiled, <doc://com.apple.documentation/documentation/Swift/false> otherwise.

## Discussion

---

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)