Device identifier for push notification, devices database management.. (IOS)

351 views Asked by At

I've already googled this problem, but I've not get any result.. the question is: how can I register a device with a unique identifier in my DB? I know that:
- the use of the UDID is deprecated so Apple reject app that use it.
- the identifierForVendor can change if I reinstall my app two or more times.
- I can use a user registration to get a unique identification, but I think that isn’t the correct way

Right now I use that code:

NSString *deviceUuid = [[[UIDevice currentDevice] identifierForVendor] UUIDString];

What is the best way to resolve this problem?

2

There are 2 answers

0
Shobhakar Tiwari On

You should consider strategies for identifying and authorizing the user instead of the device. Depending on a device-specific identifier prevents authorized users from switching devices without some sort of administrator interaction, and allows non-authorized users access if they happen to find/steal/borrow an authorized device. You can avoid these problems by relying on user credentials instead of device identifiers. Accepted answer iOS7 - Device unique identifier.

so you should use -(void)setAuthorizationToken:(NSString )authorizationToken; -(NSString)authorizationToken; -(void)setIPhoneToken:(NSString *)iPhoneToken; -(Nsstring *)iPhoneToken:(NSString *)iPhoneToken;

0
z22 On

You can only use the Device Token for Apple Push Notification. The push notification server API will only accept Device tokens and will also check if you are allowed to sent a notification to that installation by checking the Certificate.

The Device token is unique for your app on a specific device. If the user has multiple device he/she will also have multiple device tokens (one for each install of your app).

When the user deletes you app and reinstalls it the device token can also change.

Also, as you rightly mentioned in your question, the UDID is no longer useable by developers, Apple has restricted the use of the UDID.