I was checking out the UUID code from Charles Yeomans MOJO code and it noticed it wouldn’t compile. I don’t write much introspection code so the error isn’t obvious to me.
I cannot open the two links pointing to imager.com, but my assumption would be that you have a Using Xojo.Introspection clause somewhere in code or in the navigator, while Mojo is not based on the new framework.
FUNCTION UUID() as String
Dim result As String
#If TargetCocoa
Soft Declare Function NSClassFromString Lib "Cocoa" ( clsName As cfstringref ) As ptr
Soft Declare Function UUID Lib "Cocoa" selector "UUID" ( clsRef As ptr ) As ptr
Soft Declare Function UUIDString Lib "Cocoa" selector "UUIDString" ( obj_id As ptr ) As cfstringref
Dim classPtr As Ptr = NSClassFromString( "NSUUID" )
Dim NSUUID As ptr = UUID( classPtr )
result = UUIDString( NSUUID )
#ElseIf TargetWin32
Const kLibName = "win32.Rpcrt4"
Soft Declare Function UUIDCreate Lib kLibName alias "UuidCreate" ( ByRef uuid As WindowsUUID ) As Integer
Soft Declare Function UUIDToString Lib kLibName alias "UuidToStringA" ( ByRef inUUID As WindowsUUID, ByRef outString As CString ) As Integer
Dim uuid As WindowsUUID // Structure [x(15) as UInt8]
Dim out As CString
result = out
result = result.DefineEncoding( Encodings.UTF8 )
result = result.Uppercase
#EndIf
Return result
END FUNCTION
[quote=300146:@Michel Bujardet]At least iOS won’t give you access to the UUID anymore for security reasons.
You may have to settle for the MAC address.[/quote]
MIchel … would you care to expand upon that statement?
there is nothing stopping you from generating a UUID with iOS, just need the correct band-aid (I mean declare) for Xojo
In Swift and ObjC it is REALLY difficult to to
let uuid = UUID().uuidString // THIS IS NOT XOJO CODE... DO NOT PASTE INTO YOU XOJO PROJECT!!!!!!