How to get an unique ID using DeviceCheck API swift?

694 views Asked by At

hope all are doing good. I am working on a device check API now how can I get a unique id when hit the apple server? When sending the device token from mobile to our server then Our server sends the query request to APN server like this:

{
 "device_token" : "wlkCDA2Hy/CfrMqVAShs1BAR/0sAiuRIUm5jQg0a..."
 "transaction_id" : "5b737ca6-a4c7-488e-b928-8452960c4be9",
 "timestamp" : 1487716472000 
}

Then received a response from APN server as There is no bit value for this device token

After that, I have sent the update message to apple server with bit values like

{
 "device_token" : "wlkCDA2Hy/CfrMqVAShs1BAR/0sAiuRIUm5jQg0a..."
 "transaction_id" : "5b737ca6-a4c7-488e-b928-8452960c4be9",
 "timestamp" : 1487716472000,
 "bit0" : false,
 "bit1" : false 
}

Then received the successful message as

{"status":200,"bit0":false,"bit1":false,"lastUpdated":"2018-10"}

But here how can I get a unique device id? Please someone help me I mess around this for 2 days. I have referred a lot of examples but nothing helped me. Thanks in advance

1

There are 1 answers

3
Prateek kumar On

You can use the UUID string

UIDevice.current.identifierForVendor?.uuidString