简体   繁体   English

替代[UIDevice currentDevice] .identifierForVendor

[英]Alternative to [UIDevice currentDevice].identifierForVendor

I have one product that has two different applications. 我有一个产品有两个不同的应用程序。 and both the applications it gives me different Identifiers for the same device (you would assume that apple would associate this to maybe your developer account so that you can reuse the information across your applications), but I was wondering is their anything that would give me the same identifier for a device on both the applications? 并且这两个应用程序为我提供了同一设备的不同标识符(您可以假设苹果会将此与您的开发者帐户相关联,以便您可以在您的应用程序中重复使用这些信息),但我想知道他们的任何东西会给我两个应用程序上的设备的标识符相同?

identifierForVendor is really what you want. identifierForVendor真的是你想要的。 UDID is a big NO on the AppStore. UDID在AppStore上是一个很大的NO。 A user can opt out to advertisingIdentifier . 用户可以选择使用advertisingIdentifier Other ways (by MAC address, like ODIN1, and solutions that rely on UIPasteboard, as OpenUDID) will break on the future (hint: 7). 其他方式(通过MAC地址,如ODIN1,以及依赖于UIPasteboard的解决方案,如OpenUDID)将打破未来(提示:7)。

According to the docs , you should have the same identifier if both apps are from the same developer: 根据文档 ,如果两个应用程序都来自同一个开发人员,则应该具有相同的标识符:

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. 对于来自不同供应商的同一设备上的应用程序以及不同供应商的不同设备上的应用程序,将返回不同的值。

The value of this property may be nil if the app is running in the background, before the user has unlocked the device the first time after the device has been restarted. 如果应用程序在后台运行,则在用户在设备重新启动后第一次解锁设备之前,此属性的值可能为nil。 If the value is nil, wait and get the value again later. 如果值为nil,请稍后再次获取该值。

The value in this property remains the same while the app (or another app from the same vendor) is installed on the iOS device . 在iOS设备上安装app(或来自同一供应商的其他应用程序)时 ,此属性中的值保持不变 The value changes when the user deletes all of that vendor's apps from the device and subsequently reinstalls one or more of them. 当用户从设备中删除所有该供应商的应用程序并随后重新安装其中一个或多个应用程序时,该值会更改。 Therefore, if your app stores the value of this property anywhere, you should gracefully handle situations where the identifier changes. 因此,如果您的应用程序将此属性的值存储在任何位置,则应优雅地处理标识符更改的情况。

OpenUDID迄今为止最好的解决方案,即使设备重置也可以更改。

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

相关问题 为什么“ [[UIDevice currentDevice] identifierForVendor]”会导致内存泄漏? - why does “[[UIDevice currentDevice] identifierForVendor]”cause memory leak? iOS9:替代UIDevice.currentDevice()。setValue(...)强制定位 - iOS9: Alternative to UIDevice.currentDevice().setValue(…) to force orientation 方法[[UIDevice currentDevice] uniqueIdentifier]不再允许,我需要一个替代方案 - Method [[UIDevice currentDevice] uniqueIdentifier] is not allowed any more, I need an alternative UIDevice.currentDevice()。beginGeneratingDeviceOrientationNotifications()无法正常工作 - UIDevice.currentDevice().beginGeneratingDeviceOrientationNotifications() not working [UIDevice currentDevice]可以使用什么? - What can be used with [UIDevice currentDevice]? Swift UIDevice.currentDevice()无法编译 - Swift UIDevice.currentDevice() not compiling UIDevice currentDevice模型可能的值 - UIDevice currentDevice model possible values [[UIDevice currentDevice] systemName] 的可能值; - Possible values for [[UIDevice currentDevice] systemName]; 如何设置通知对象的“ UIDevice.currentDevice()”? - How to set the 'UIDevice.currentDevice()' for object of notification? 使用OCMock模拟[[UIDevice currentDevice] userInterfaceIdiom] - Using OCMock to mock [[UIDevice currentDevice] userInterfaceIdiom]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM