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:
- device id
- device token
which I respectively get with:
let device = UIDevice.currentDevice().identifierForVendor!.UUIDString
let deviceTokenString: String = ( deviceToken.description as NSString ).stringByTrimmingCharactersInSet( characterSet ).stringByReplacingOccurrencesOfString( " ", withString: "" ) as String
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 here) 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?