简体   繁体   English

react-native-device-info `getUniqueId()` 是否提供 UUID 或 GUID?

[英]Does react-native-device-info `getUniqueId()` give UUID or GUID?

In my React Native app, I have to pass a unique ID to an API endpoint, and I've been told that it has to be a GUID.在我的 React Native 应用程序中,我必须将唯一 ID 传递给 API 端点,并且有人告诉我它必须是 GUID。 What I want to know is:我想知道的是:

1) Does the getUniqueId() method in react-native-device-info give a GUID? 1) react-native-device-info中的getUniqueId()方法是否提供 GUID?

2) I've seen another module react-native-create-guid . 2)我见过另一个模块react-native-create-guid It says that it "creates" a GUID.它说它“创建”了一个 GUID。 I thought that the device automatically has a GUID associated with it?我认为该设备自动具有与之关联的 GUID?

GUID/UUID is not a device ID. GUID/UUID 不是设备 ID。 It is a standard of a unique identifier that is statistically unlikely to be duplicated.它是统计上不可能被复制的唯一标识符的标准 GUIDs are used virtually everywhere, and not only when you need to identify a device. GUID 几乎无处不在,不仅在您需要识别设备时使用。 react-native-create-guid is a general-purpose library unrelated to the device identification domain. react-native-create-guid是一个与设备识别域无关的通用库。

As for the device ID, can be a GUID/UUID, or it can be something else – any random string.至于设备 ID,可以是 GUID/UUID,也可以是其他东西——任何随机字符串。 It is up to the device manufacturer and standards imposed by the platform.这取决于设备制造商和平台规定的标准。 If I remember correctly, on Android the Device ID is not guaranteed to be a GUID at all.如果我没记错的话,在 Android 上,设备 ID 根本不能保证是 GUID。 On iOS, on the other hand, the device ID is indeed a UUID.另一方面,在 iOS 上,设备 ID 确实是 UUID。 The identifier is called "IDFV" and it is generated in a peculiar way – see Apple's documentation for more details .该标识符称为“IDFV”,它以一种特殊的方式生成—— 有关更多详细信息,请参阅 Apple 的文档

You need to talk with your backend engineer to clarify the requirements.您需要与您的后端工程师交谈以阐明要求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM