objective c - get UDID of IOS device programmatically? -
this question has answer here:
- uidevice uniqueidentifier deprecated - now? 33 answers
i want udid of ios device programmatically. using following code udid of ios device.
nsuuid *uuid = [nsuuid uuid]; nsstring *uuidstring = uuid.uuidstring;
but output different actual udid of device.
nsstring* identifier = [[[uidevice currentdevice] identifierforvendor] uuidstring]; // ios 6+ nslog(@"output : %@", identifier);
swift 2.x (here x denote above version 2.0)
let identifier: string = uidevice.currentdevice().identifierforvendor().uuidstring() nslog("output : %@", identifier)
swift3
let identifier = uidevice.current.identifierforvendor?.uuidstring nslog("output : %@", identifier! string)
additional reference
apple apparently starting remove access udid (unique device identifier) in ios5. in event, best can identification purposes use uuid (universally unique identifier). has on per-app basis. is, there no way identify device longer, can identify app on device.as long user doesn’t delete app, identifier persist between app launches, , @ least let identify same user using particular app on device. unfortunately, if user deletes , reinstalls app id change, best can going forward.
Comments
Post a Comment