Mac Developer Library

Developer

SystemConfiguration Framework Reference SCPreferencesSetSpecific Reference

Options
Deployment Target:

On This Page
Language:

SCPreferencesSetSpecific Reference

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import SystemConfiguration

Objective-C

@import SystemConfiguration;

The functions in the SCPreferencesSetSpecific programming interface allow an application to set specific configuration information about the current system (for example, the computer or sharing name). Note that to access configuration preferences, you must first establish a preferences session using the SCPreferencesCreate function.

Functions

  • Sets the computer name preference to the specified name.

    Declaration

    Swift

    func SCPreferencesSetComputerName(_ prefs: SCPreferences!, _ name: CFString!, _ nameEncoding: CFStringEncoding) -> Boolean

    Objective-C

    Boolean SCPreferencesSetComputerName ( SCPreferencesRef prefs, CFStringRef name, CFStringEncoding nameEncoding );

    Parameters

    prefs

    The preferences session.

    name

    The computer name.

    nameEncoding

    The encoding associated with the computer name.

    Return Value

    TRUE if successful; otherwise, FALSE.

    Discussion

    To commit these changes to permanent storage you must call the SCPreferencesCommitChanges function. In addition, you must call the SCPreferencesApplyChanges function for the new name to become active.

    Import Statement

    Objective-C

    @import SystemConfiguration;

    Swift

    import SystemConfiguration

    Availability

    Available in OS X v10.1 and later.

  • Sets the local host name to the specified name.

    Declaration

    Swift

    func SCPreferencesSetLocalHostName(_ prefs: SCPreferences!, _ name: CFString!) -> Boolean

    Objective-C

    Boolean SCPreferencesSetLocalHostName ( SCPreferencesRef prefs, CFStringRef name );

    Parameters

    prefs

    The preferences session.

    name

    The local host name. This string must conform to the naming conventions of a DNS host name as specified in RFC 1034 (section 3.5).

    Return Value

    TRUE if successful; otherwise, FALSE.

    Discussion

    To commit these changes to permanent storage you must call the SCPreferencesCommitChanges function. In addition, you must call the SCPreferencesApplyChanges function for the new name to become active.

    Import Statement

    Objective-C

    @import SystemConfiguration;

    Swift

    import SystemConfiguration

    Availability

    Available in OS X v10.2 and later.