Swift: why does device change every time a new app version is built/installed?
<p>As many of you know, in order to give support for push notifications in my app I need two things to be stored in MySQL:</p>

<ul>
<li>device id</li>
<li>device token</li>
</ul>

<p>which I respectively get with:</p>

<ul>
<li><code>let device = UIDevice.currentDevice().identifierForVendor!.UUIDString</code></li>
<li><code>let deviceTokenString: String = ( deviceToken.description as NSString ).stringByTrimmingCharactersInSet( characterSet ).stringByReplacingOccurrencesOfString( " ", withString: "" ) as String</code></li>
</ul>

<p>Always as you know, each time the app is launched it tries to register into the apposite MySQL table push notifications but if it is already present (its device id is already present) then the new registration is discarded. Anyway, I have just understood (as explained <a href="https://stackoverflow.com/questions/25925481/how-to-get-a-unique-device-id-in-swift">here</a>) the device id changes each time a new version of the application is re-installed in my iPhone. The risk is to populate the table eith too many useless entries. Is there a way to keep the same device id? Or, what is the smartest way to handle this?</p>