# GCKDevice Class

[Instance Methods](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#pub-methods) \| [Class Methods](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#pub-static-methods) \| [Properties](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#properties) GCKDevice Class Reference

## Overview

An object representing a receiver device.

Inherits NSObject, \<NSCopying\>, and \<NSSecureCoding\>.

|---|---|
| ## Instance Method Summary ||
| (instancetype) | - **init** |
|   ||
| (BOOL) | - [isSameDeviceAs:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a431377a90931ac06c20d76c87f02d383) |
|   | Tests if this device refers to the same physical device as another. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a431377a90931ac06c20d76c87f02d383) |
|   ||
| (BOOL) | - [hasCapabilities:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#ad2d54d60517308097ae26ff555062803) |
|   | Returns `YES` if the device supports all of the given capabilities. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#ad2d54d60517308097ae26ff555062803) |
|   ||
| (void) | - [setAttribute:forKey:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a2f860e9144e76a3116d6dfd1e9f31d0d) |
|   | Sets an arbitrary attribute in the object. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a2f860e9144e76a3116d6dfd1e9f31d0d) |
|   ||
| (nullable NSObject \< NSSecureCoding \> \*) | - [attributeForKey:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#abe334c31aebac6ca1cb264a96dcc4e43) |
|   | Looks up an attribute in the object. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#abe334c31aebac6ca1cb264a96dcc4e43) |
|   ||
| (void) | - [removeAttributeForKey:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a1396e449fb3b1f2e7c8aac9c7c8ef77e) |
|   | Removes an attribute from the object. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a1396e449fb3b1f2e7c8aac9c7c8ef77e) |
|   ||
| (void) | - [removeAllAttributes](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#ae346957b96ad7d7d2e1bc4814d54b161) |
|   | Removes all attributes from the object. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#ae346957b96ad7d7d2e1bc4814d54b161) |
|   ||

|---|---|
| ## Class Method Summary ||
| (NSString \*) | + [deviceCategoryForDeviceUniqueID:](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a5018ca6a6115edec001eb46a5696fe2c) |
|   | Extracts the device category from a device unique ID. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a5018ca6a6115edec001eb46a5696fe2c) |
|   ||

|---|---|
| ## Property Summary ||
| NSString \* | [ipAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a04d0be447e9173a2d2dc691d8bcdbcfe) |
|   ||
| [GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address) \* | [networkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a27cbca73b00340d4fa1147f007c7190c) |
|   | The device's IP address. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a27cbca73b00340d4fa1147f007c7190c) |
|   ||
| uint16_t | [servicePort](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#aa456b21cc2b7d68a8e27522690fe165c) |
|   | The device's service port. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#aa456b21cc2b7d68a8e27522690fe165c) |
|   ||
| NSString \* | [deviceID](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#ac573fca7dfbb317bad4095a25435948e) |
|   | A unique identifier for the device. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#ac573fca7dfbb317bad4095a25435948e) |
|   ||
| NSString \* | [friendlyName](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a3de90f6a33ae5776e33ec631dee3893d) |
|   | The device's friendly name. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a3de90f6a33ae5776e33ec631dee3893d) |
|   ||
| NSString \* | [modelName](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a9a64928b2032f1fde08bca3c94d64b31) |
|   | The device's model name. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a9a64928b2032f1fde08bca3c94d64b31) |
|   ||
| NSArray\< [GCKImage](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_image) \* \> \* | [icons](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#ae379b4a588045efc0b4876690df3c2d0) |
|   | An array of [GCKImage](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_image "A class that represents an image that is located on a web server. ") objects containing icons for the device. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#ae379b4a588045efc0b4876690df3c2d0) |
|   ||
| GCKDeviceStatus | [status](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a157857aac29f66747bdaa1685528ab0a) |
|   | The device's status at the time that it was most recently scanned. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a157857aac29f66747bdaa1685528ab0a) |
|   ||
| NSString \* | [statusText](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a72417f177891bb6e996640a1761067bb) |
|   | The status text reported by the currently running receiver application, if any. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a72417f177891bb6e996640a1761067bb) |
|   ||
| NSString \* | [deviceVersion](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a83f2cf55f6c81efc81c8ce7c971033f5) |
|   | The device's protocol version. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a83f2cf55f6c81efc81c8ce7c971033f5) |
|   ||
| BOOL | [isOnLocalNetwork](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#ad1091e0d9e8c797d420db154dbcf6af7) |
|   | YES if this device is on the local network. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#ad1091e0d9e8c797d420db154dbcf6af7) |
|   ||
| [GCKDeviceType](https://developers.google.com/cast/docs/reference/ios/g_c_k_device_8h#a82782e5a6bc6438a8ced1268162a109e) | [type](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a17c45ad2e3cb0e865286b302dc8c5642) |
|   | The device type. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a17c45ad2e3cb0e865286b302dc8c5642) |
|   ||
| NSString \* | [category](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#adc674458ad7067329a196626df519189) |
|   | The device category, a string that uniquely identifies the type of device. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#adc674458ad7067329a196626df519189) |
|   ||
| NSString \* | [uniqueID](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a7c834d64a3c55ba90666ee334c7e2071) |
|   | A globally unique ID for this device. [More...](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a7c834d64a3c55ba90666ee334c7e2071) |
|   ||

## Method Detail

|---|---|---|---|---|
| - (BOOL) isSameDeviceAs: |   | (const [GCKDevice](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device) \*) | *other* |   |

Tests if this device refers to the same physical device as another.

Returns `YES` if both [GCKDevice](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device "An object representing a receiver device. ") objects have the same category, device ID, IP address, service port, and protocol version.

|---|---|---|---|---|
| - (BOOL) hasCapabilities: |   | (GCKDeviceCapabilities) | *deviceCapabilities* |   |

Returns `YES` if the device supports all of the given capabilities.

Parameters
:

    |---|---|
    | deviceCapabilities | A bitwise-OR of one or more of the GCKDeviceCapabilities constants. |


|---|---|---|---|
| - (void) setAttribute: |   | (NSObject\< NSSecureCoding \> \*) | *attribute* |
| forKey: |   | (NSString \*) | *key* |
|   |   |   |   |

Sets an arbitrary attribute in the object.

May be used by custom device providers to store device-specific information for non-Cast devices.

Parameters
:

    |---|---|
    | attribute | The attribute value, which must be key-value coding compliant, and cannot be `nil`. |
    | key | The key that identifies the attribute. The key is an arbitrary string. It cannot be `nil`. |


|---|---|---|---|---|
| - (nullable NSObject\<NSSecureCoding\> \*) attributeForKey: |   | (NSString \*) | *key* |   |

Looks up an attribute in the object.

Parameters
:

    |---|---|
    | key | The key that identifies the attribute. The key is an arbitrary string. It cannot be `nil`. |


Returns
:   The value of the attribute, or `nil` if no such attribute exists.

|---|---|---|---|---|
| - (void) removeAttributeForKey: |   | (NSString \*) | *key* |   |

Removes an attribute from the object.

Parameters
:

    |---|---|
    | key | The key that identifies the attribute. The key is an arbitrary string. It cannot be `nil`. |


|---|---|---|---|
| - (void) removeAllAttributes |   |   |   |

Removes all attributes from the object.

|---|---|---|---|---|
| + (NSString \*) deviceCategoryForDeviceUniqueID: |   | (NSString \*) | *deviceUniqueID* |   |

Extracts the device category from a device unique ID.

## Property Detail

|---|---|
| |---| | - (NSString\*) ipAddress | | readnonatomiccopy |

**[Deprecated:](https://developers.google.com/cast/docs/reference/ios/deprecated#_deprecated000003)**
:   Use [networkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#a27cbca73b00340d4fa1147f007c7190c) The device's IPv4 address, in dot-notation. Used when making network requests. This will be an empty string for [GCKDevice](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device) objects that are created with an IPv6 address.

|---|---|
| |---| | - ([GCKNetworkAddress](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_network_address)\*) networkAddress | | readnonatomiccopy |

The device's IP address.

Used when making network requests.

Since
:   4.2

|---|---|
| |---| | - (uint16_t) servicePort | | readnonatomicassign |

The device's service port.

|---|---|
| |---| | - (NSString\*) deviceID | | readnonatomiccopy |

A unique identifier for the device.

|---|---|
| |---| | - (NSString\*) friendlyName | | readwritenonatomiccopy |

The device's friendly name.

This is a user-assignable name such as "Living Room".

|---|---|
| |---| | - (NSString\*) modelName | | readwritenonatomiccopy |

The device's model name.

|---|---|
| |---| | - (NSArray\<[GCKImage](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_image) \*\>\*) icons | | readwritenonatomiccopy |

An array of [GCKImage](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_image "A class that represents an image that is located on a web server. ") objects containing icons for the device.

|---|---|
| |---| | - (GCKDeviceStatus) status | | readwritenonatomicassign |

The device's status at the time that it was most recently scanned.

|---|---|
| |---| | - (NSString\*) statusText | | readwritenonatomiccopy |

The status text reported by the currently running receiver application, if any.

|---|---|
| |---| | - (NSString\*) deviceVersion | | readwritenonatomiccopy |

The device's protocol version.

|---|---|
| |---| | - (BOOL) isOnLocalNetwork | | readnonatomicassign |

YES if this device is on the local network.

|---|---|
| |---| | - ([GCKDeviceType](https://developers.google.com/cast/docs/reference/ios/g_c_k_device_8h#a82782e5a6bc6438a8ced1268162a109e)) type | | readnonatomicassign |

The device type.

Since
:   3.3

|---|---|
| |---| | - (NSString\*) category | | readnonatomiccopy |

The device category, a string that uniquely identifies the type of device.

Cast devices have a category of [kGCKCastDeviceCategory](https://developers.google.com/cast/docs/reference/ios/g_c_k_device_8h#aeff3718b2baa2a0f541b3296c5469d47).

|---|---|
| |---| | - (NSString\*) uniqueID | | readnonatomiccopy |

A globally unique ID for this device.

This is a concatenation of the [category](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#adc674458ad7067329a196626df519189) and [deviceID](https://developers.google.com/cast/docs/reference/ios/interface_g_c_k_device#ac573fca7dfbb317bad4095a25435948e) properties.