为什么iOS会在应用更新时获得新的identifierForVendor? [英] Why does iOS get a new identifierForVendor when app updates?

查看:136
本文介绍了为什么iOS会在应用更新时获得新的identifierForVendor?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次从App Store更新我的应用时,由于某种原因,少数用户会获得新的 identifierForVendor 。我的用户没有注册或登录。它们都是匿名的,所以我需要通过它们的供应商ID将它们分开。

Every time my app is updated from the App Store some small number of the users get a new identifierForVendor for some reason. My users don't sign up or login. They are all anonymous so I need to separate them through their vendor IDs.

我认为某些设备上的空间可能不足,导致应用程序被删除并重新安装,但事实并非如此,因为在上一次更新中,我的一个朋友有超过2GB的空白空间。

I've considered that there could've been insufficient space on some devices, resulting in the app being deleted and reinstalled, but that's not the case since in the last update a friend of mine had over 2GB of empty space.

我知道 identifierForVendor <删除并重新安装应用程序的用户更改了/ em>。但这不是这里的情况,因为应用程序刚刚更新。

I know that the identifierForVendor is changed for a user who deletes and reinstalls the app. But that's not the case here, as the app is just updated.

问题是什么?奇怪的是,尚未发现开发团队设备。或者仍然有用户在无数应用更新,操作系统更新等之后没有遇到此错误。这只发生在一小部分用户身上。所有用户都是iOS7 +,它适用于不同的设备型号和iOS版本。

What could the problem be? The weird part is that this hasn't happened for development team devices yet. Or there are still users who haven't experienced this bug after countless app updates, OS updates, etc. This only happens to a small percentage of the users. All users are iOS7+ and it happens for different device models and iOS versions.

我使用此代码获取他们的ID:

I use this code to get their ID:

static let DeviceId = UIDevice.currentDevice().identifierForVendor.UUIDString

然后我将它们保存到NSUserDefaults中:

Then I save them into NSUserDefaults:

NSUserDefaults.standardUserDefaults().setBool(true, forKey: "User" + DeviceId)
NSUserDefaults.standardUserDefaults().synchronize()

然后我检查是否用户存在,每次新登录时:

Then I check if the user exists, at every new login:

static func doesUserExist() -> Bool {
    var userDefaultValue: AnyObject? = NSUserDefaults.standardUserDefaults().valueForKey("User" + DeviceId)

    if defaultValue == true {
        println("Userdefaults already has this guy, moving on")
        FirstTime = false
        return true
    } else {
        println("First time in the app!")
        FirstTime = true
        return false
    }
}

如果用户确实存在,则启动登录过程。如果用户不存在,则向他们显示注册过程。我使用Parse.com作为后端,deviceID用作用户名。当少量用户遇到此错误时,我会看到一个新用户名和一个新帐户。

If the user does exist it starts the login process. If the user does not exist it shows them the signup process. I am using Parse.com as backend and the deviceID is used as a username. When that small amount of users experience this bug, I see a new username and a new account created.

推荐答案

有一个错误在5月到7月期间从应用商店更新应用时会影响identifierForVendor的计算。 Apple声称他们已经解决了这个问题并且推动另一次更新应该在关键日期之前恢复原始值。
参考: https://openradar.appspot.com/22677034

There was a bug affecting the calculation of identifierForVendor when updating an app from app store between May and July. Apple has claimed they have already solved the issue and pushing another update should restore the original value before the critical date. Reference: https://openradar.appspot.com/22677034

请注意,即使在7月之后的几周内更新,一些用户仍然会观察到此问题。所以仍有可能某些bug仍然存在,或者它可能在将来的任何时候重新出现。因此,如果您将此数据用作加密的一部分,最好将其保存到钥匙串中。

Take note that some users still have observed this issue even updating weeks after July. So it is still possible that bug is still there for some or it could resurface anytime in the future. So if you are using this data as part of your encryption, best is to save this to the keychain.

这篇关于为什么iOS会在应用更新时获得新的identifierForVendor?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆