gpt4 book ai didi

ios - 如何比较 NSUUID

转载 作者:可可西里 更新时间:2023-11-01 03:37:12 29 4
gpt4 key购买 nike

比较两个 NSUUID 的最佳(最少代码、最快、最可靠)方法是什么?

这是一个例子:

-(BOOL)isUUID:(NSUUID*)uuid1 equalToUUID:(NSUUID*)uuid2
{
return ... // YES if same or NO if not same
}

最佳答案

来自 NSUUID 类引用:

Note: The NSUUID class is not toll-free bridged with CoreFoundation’s CFUUIDRef. Use UUID strings to convert between CFUUID and NSUUID, if needed. Two NSUUID objects are not guaranteed to be comparable by pointer value (as CFUUIDRef is); use isEqual: to compare two NSUUID instances.

所以只需使用以下内容:

-(BOOL)isUUID:(NSUUID*)uuid1 equalToUUID:(NSUUID*)uuid2
{
return [uuid1 isEqual:uuid2];
}

关于ios - 如何比较 NSUUID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20525829/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com