<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.5.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SystemConfiguration",
  "identifier" : "/documentation/SystemConfiguration/SCCopyLastError()",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "System Configuration"
    ],
    "preciseIdentifier" : "c:@F@SCCopyLastError"
  },
  "title" : "SCCopyLastError()"
}
-->

# SCCopyLastError()

Returns an error or status code associated with the most recent function call.

```
func SCCopyLastError() -> CFError
```

## Return Value

The most recent status or error code generated as the result of calling a function defined by the System Configuration framework. The code is represented by a Core Foundation `CFErrorRef` opaque type.

## Discussion

Call the <doc://com.apple.documentation/documentation/CoreFoundation/CFErrorGetCode(_:)> function on the returned object to get the underlying error-code integer. See [Status and Error Codes](/documentation/SystemConfiguration/1518026-status-and-error-codes) for descriptions of these codes. For more on `CFErrorRef` objects, see <doc://com.apple.documentation/documentation/CoreFoundation/CFError>.

---

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)