GCKDevice 类
    
    
      
    
    
      
      使用集合让一切井井有条
    
    
      
      根据您的偏好保存内容并对其进行分类。
    
  
    
  
      
    
  
  
  
  
  
  
    
    
    
继承 NSObject、<NSCopy> 和 <NSSecureCoding>。
      
        
          | - (BOOL) isSameDeviceAs:  | 
           | 
          (const GCKDevice *)  | 
          other | 
           | 
        
      
 
用于测试此设备是否指代另一台设备。
如果两个 GCKDevice 对象具有相同的类别、设备 ID、IP 地址、服务端口和协议版本,则返回 YES。
 
 
      
        
          | - (BOOL) hasCapabilities:  | 
           | 
          (GCKDeviceCapabilities)  | 
          deviceCapabilities | 
           | 
        
      
 
如果设备支持所有给定功能,则返回 YES。
- Parameters
 - 
  
    | deviceCapabilities | A bitwise-OR of one or more of the GCKDeviceCapabilities constants.  | 
  
   
 
 
      
        
          | - (void) setAttribute:  | 
           | 
          (NSObject< NSSecureCoding > *)  | 
          attribute | 
        
        
          | forKey: | 
           | 
          (NSString *)  | 
          key  | 
        
        
           | 
           | 
           |  | 
        
      
 
设置对象中的任意属性。
自定义设备提供商可以使用它来存储非 Cast 设备的设备特定信息。
- 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 | 
           | 
        
      
 
在对象中查找属性。
- Parameters
 - 
  
    | key | The key that identifies the attribute. The key is an arbitrary string. It cannot be nil.  | 
  
   
- 返回
 - 属性的值,如果此类属性不存在,则为 
nil。 
 
 
      
        
          | - (void) removeAttributeForKey:  | 
           | 
          (NSString *)  | 
          key | 
           | 
        
      
 
从对象中移除属性。
- Parameters
 - 
  
    | key | The key that identifies the attribute. The key is an arbitrary string. It cannot be nil.  | 
  
   
 
 
      
        
          | - (void) removeAllAttributes  | 
           | 
           | 
           | 
        
      
 
 
      
        
          | + (NSString *) deviceCategoryForDeviceUniqueID:  | 
           | 
          (NSString *)  | 
          deviceUniqueID | 
           | 
        
      
 
 
设备的 IP 地址。
在发出网络请求时使用。
- 开始时间
 - 4.2 
 
 
 
  
  
      
        
          | - (NSString*) friendlyName | 
         
       
   | 
  
readwritenonatomiccopy   | 
  
 
设备的易记名称。
这是可由用户指定的名称,例如“Living Room”。
 
 
  
  
      
        
          | - (GCKDeviceStatus) status | 
         
       
   | 
  
readwritenonatomicassign   | 
  
 
 
当前正在运行的接收器应用报告的状态文本(如果有)。
 
 
  
  
      
        
          | - (NSString*) deviceVersion | 
         
       
   | 
  
readwritenonatomiccopy   | 
  
 
 
  
  
      
        
          | - (BOOL) isOnLocalNetwork | 
         
       
   | 
  
readnonatomicassign   | 
  
 
 
 
  
  
  
 
  
    
    
    
  
  
  如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
  最后更新时间 (UTC):2025-07-25。
  
  
  
    
      [[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-07-25。"],[],["The GCKDevice class represents a receiver device, inheriting from NSObject. Key actions include: checking if a device is the same as another (`isSameDeviceAs:`), verifying device capabilities (`hasCapabilities:`), setting, retrieving, and removing attributes (`setAttribute:forKey:`, `attributeForKey:`, `removeAttributeForKey:`, `removeAllAttributes`), and extracting device category from a unique ID (`deviceCategoryForDeviceUniqueID:`). The class also exposes properties like `ipAddress`, `networkAddress`, `servicePort`, `deviceID`, `friendlyName`, `modelName`, `icons`, `status`, `statusText`, `deviceVersion`, `isOnLocalNetwork`, `type`, `category`, and `uniqueID` for device identification and management.\n"]]