How to get the device UDID

Hello everyone!
Is there a way to get the device UDID in Xojo?
I need to have a unique identifier for the device to be able to identify its access rights communicating to a web service.
Any help will be greatly appreciated.

The access to the UDID has been deprecated in iOS 5.0:

[quote]uniqueIdentifier
An alphanumeric string unique to each device based on various hardware details. (read-only) (Deprecated in iOS 5.0. Instead, create a unique identifier specific to your app.)[/quote]

For … a unique identifier specific to your app use:
identifierForVendor

Thanks Eli, but how can I get this unique identifier from Xojo?

Through declares.

Thank you again, I will try to write to do that. I just hoped that it was done by someone and could share his code (using the needed declares).

https://github.com/kingj5/iOSKit

[code]Declare Function NSClassFromString Lib “Foundation” (className As CFStringRef) As Ptr

Declare Function currentDevice Lib “UIKit” Selector “currentDevice” (UIDeviceClass As Ptr) As Ptr
Declare Function identifierForVendor Lib “UIKit” Selector “identifierForVendor” (UIDevice As Ptr) As Ptr
Declare Function UUIDString Lib “UIKit” Selector “UUIDString” (NSUUID As Ptr) As CFStringRef

Dim UIDeviceClassPtr As Ptr = NSClassFromString(“UIDevice”)
Dim UIDevicePtr As Ptr = currentDevice(UIDeviceClassPtr)
Dim NSSUIDPtr As Ptr = identifierForVendor(UIDevicePtr)
Dim uuid As Text = UUIDString(NSSUIDPtr)[/code]

Thanks Michel, that can solve my problem…

Thank you Eli very much for the code.

The name is actually a bit misleading. I think the extension method should be renamed identifierForVendor. The identifierForVendor returns the same value as long as the app is not deinstalled on the device. Which is quite different to regular GUIDs which are temporarily created for an app session. There is a class in iOS which one can use for these kind of GUIDs:
NSUUID Class Reference