gpt4 book ai didi

ios - Objective C 为不重复的对象生成随机 ID

转载 作者:行者123 更新时间:2023-11-28 19:55:47 25 4
gpt4 key购买 nike

我想生成唯一标识来标识对象,遇到过[[NSUUID UUID] UUIDString],可以用来做唯一标识吗?还是有更好的生成方法?

最佳答案

是的:NSUUID 生成一个唯一的 ID。

来自苹果:

UUIDs (Universally Unique Identifiers), also known as GUIDs (Globally Unique Identifiers) or IIDs (Interface Identifiers), are 128-bit values. UUIDs created by NSUUID conform to RFC 4122 version 4 and are created with random bytes.

来自 RFC 4122 :

A UUID is 128 bits long, and can guarantee uniqueness across space and time.

关于ios - Objective C 为不重复的对象生成随机 ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26511133/

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