How to turn CBUUID into string

前端 未结 8 1003
太阳男子
太阳男子 2020-12-28 20:11

I can\'t find any official way to get a UUID string back out of a CBUUID. These UUIDs can be 2 or 16 bytes long.

The goal is to store CBUUIDs in a file somewhere as

8条回答
  •  伪装坚强ぢ
    2020-12-28 20:35

    iOS 7.1 (beta released yesterday, 11/18/13) introduced the following property on CBUUID:

    @property(nonatomic, readonly) NSString *UUIDString

    The UUID represented as a string. (read-only)

    From CBUUID Class Reference.

    It's also worth noting that for comparing a UUID string with a CBUUID, this works:

    if ([cbuuidInQuestion isEqual:[CBUUID UUIDWithString:@"1234-5678-9012-1234"]]) {
        // isEqual tests for "the same UUID"
        // == tests for "the same CBUUID object"
    }
    

提交回复
热议问题