iOS Question How to generate random UUID?

Discussion in 'iOS Questions' started by klarsys, May 28, 2015.

  1. klarsys

    klarsys Active Member Licensed User

    I used following code in B4A:
    Code:
    Dim r As Reflector
    r.Target = r.RunStaticMethod(
    "java.util.UUID""randomUUID"NullNull)
    UUID = r.RunMethod(
    "toString")
    How do I generate such in B4i?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Code:
    Sub RandomUUID As String
       
    Dim no As NativeObject
       
    Return no.Initialize("NSUUID").RunMethod("UUID"Null).RunMethod("UUIDString"Null).AsString
    End Sub
    Log(RandomUUID)
     
    klarsys likes this.
  3. klarsys

    klarsys Active Member Licensed User

    Thank you!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice