美文网首页iOS
iOS-UUID卸载安装后变化问题

iOS-UUID卸载安装后变化问题

作者: 丿小七 | 来源:发表于2022-03-08 11:50 被阅读0次

    iOS.获取设备唯一标识符

    iOS -uuidstring保存到keychain

    [UIDevice currentDevice].identifierForVendor.UUIDString

    通过系统提供的获取uuidstring 的方式返回的由数字和字母组成的用来标识唯一设备的字符串。

    identifierForVendor

    An alphanumeric string that uniquely identifies a device to the app’s vendor.
    一个由字母和数字组成的字符串,唯一地将设备标识给应用程序的供应商

    对于在同一设备上运行的来自同一供应商的应用程序,此属性的值是相同的。对于同一设备上来自不同供应商的应用程序,以及不同设备上的应用程序,不管供应商是什么,都会返回不同的值。

    卸载app之后重新安装vendor变不变

    • 如果设备上还存在有同样vendor的应用

    卸载之后在次安装,vendor还是不会变,获取到的uuidstring不会变,

    • 如果设备上没有同样的vendor的应用了

    卸载之后再次安装,uuidstrign会被重置。

    结论
    按个人理解,就是uuidstring是变化的, 如果同一厂商有不同的app,同时存在,删除某一个(A),则在重新安装那一个(A),A的uuidstring还是不变的,不会重置,如果该厂商下的app全部删除了,那么A的uuidstring就会被重置。

    注意:

    如果用户卸载了同一个vendor对应的所有程序,然后在重新安装同一个vendor提供的程序,此时identifierForVendor会被重置

    Discussion
    The value of this property is the same for apps that come from the same vendor running on the same device. A different value is returned for apps on the same device that come from different vendors, and for apps on different devices regardless of vendor.
    Normally, the vendor is determined by data provided by the App Store. If the app was not installed from the app store (such as enterprise apps and apps still in development), then a vendor identifier is calculated based on the app’s bundle ID. The bundle ID is assumed to be in reverse-DNS format.(通常,供应商是由App Store提供的数据决定的。如果应用程序不是从应用商店安装的(比如企业应用程序和仍在开发中的应用程序),那么根据应用程序的bundle ID计算供应商标识符。bundle ID被假定为反向dns格式。

    • On iOS 6, the first two components of the bundle ID are used to generate the vendor ID. if the bundle ID only has a single component, then the entire bundle ID is used. (在iOS 6上,bundle ID的前两个组件用于生成供应商ID。如果bundle ID只有一个组件,那么整个bundle ID就会被使用。
    • On IOS 7, all components of the bundle except for the last component are used to generate the vendor ID. If the bundle ID only has a single component, then the entire bundle ID is used.(在IOS 7上,除了最后一个组件外,该bundle的所有组件都用于生成供应商ID。如果bundle ID只有一个组件,那么将使用整个bundle ID。

    Table 1 shows a collection of bundle IDs and which portions of the bundle ID the system uses to calculate the vendor ID.

    Table 1 Example bundle identifiers

    image.png

    For example, com.example.app1 and com.example.app2 would appear to have the same vendor ID.
    If the value is nil, wait and get the value again later. This happens, for example, after the device has been restarted but before the user has unlocked the device.
    The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device. The value changes when the user deletes all of that vendor’s apps from the device and subsequently reinstalls one or more of them. The value can also change when installing test builds using Xcode or when installing an app on a device using ad-hoc distribution. Therefore, if your app stores the value of this property anywhere, you should gracefully handle situations where the identifier changes.(当应用程序(或来自同一供应商的另一个应用程序)安装在iOS设备上时,该属性中的值保持不变。当用户从设备上删除该供应商的所有应用程序,并随后重新安装其中一个或多个应用程序时,该值将发生变化。这个值也可以在使用Xcode安装测试版本或使用特别分发方式在设备上安装应用程序时改变。因此,如果你的应用程序将这个属性的值存储在任何地方,你应该优雅地处理标识符改变的情况。

    相关文章

      网友评论

        本文标题:iOS-UUID卸载安装后变化问题

        本文链接:https://www.haomeiwen.com/subject/fzcarrtx.html