# MOJO Type Mismatch - Charles Yeoman's code

**URL:** <https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648>\
**Category:** General\
**Created:** [November 26, 2016, 4:18am UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648 "2016-11-26T04:18:05Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Joseph\_Claeys](https://forum.xojo.com/user_avatar/forum.xojo.com/joseph_claeys/32/1104_2.png) [@Joseph\_Claeys](https://forum.xojo.com/u/Joseph_Claeys)\
**Post date:** [November 26, 2016, 4:18am UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/1 "2016-11-26T04:18:05Z")

</div>

I was checking out the UUID code from [Charles Yeomans MOJO code](https://github.com/declaresub/mojo) and it noticed it wouldn’t compile. I don’t write much introspection code so the error isn’t obvious to me.

[Relevant Code](http://imgur.com/E6kL7Oo)

Evidently it’s a type mismatch but from what I can tell they’re both “typeinfo.”

[Error](http://imgur.com/a/QTs98)

---

<div class="post-metadata">

**Author:** ![Eli\_Ott](https://forum.xojo.com/letter_avatar_proxy/v4/letter/e/5f8ce5/32.png) [@Eli\_Ott](https://forum.xojo.com/u/Eli_Ott)\
**Post date:** [November 26, 2016, 5:00am UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/2 "2016-11-26T05:00:20Z")

</div>

I cannot open the two links pointing to [imager.com](http://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.

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [November 26, 2016, 5:01am UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/3 "2016-11-26T05:01:11Z")

</div>

```auto
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
```

---

<div class="post-metadata">

**Author:** ![Joseph\_Claeys](https://forum.xojo.com/user_avatar/forum.xojo.com/joseph_claeys/32/1104_2.png) [@Joseph\_Claeys](https://forum.xojo.com/u/Joseph_Claeys)\
**Post date:** [November 26, 2016, 12:52pm UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/4 "2016-11-26T12:52:56Z")

</div>

> [@300096:@Eli Ott](#):
>
> I cannot open the two links pointing to [imager.com](http://imager.com)

That’s strange. They open up fine for me. Are you on mobile?

---

<div class="post-metadata">

**Author:** ![Joseph\_Claeys](https://forum.xojo.com/user_avatar/forum.xojo.com/joseph_claeys/32/1104_2.png) [@Joseph\_Claeys](https://forum.xojo.com/u/Joseph_Claeys)\
**Post date:** [November 26, 2016, 12:54pm UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/5 "2016-11-26T12:54:06Z")

</div>

Thanks for the code Dave. However, I was looking for something that would work across all the platforms including the Web (linux) and mobile.

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [November 26, 2016, 1:57pm UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/6 "2016-11-26T13:57:08Z")

</div>

At least iOS won’t give you access to the UUID anymore for security reasons.

You may have to settle for the MAC address.

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [November 26, 2016, 3:39pm UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/7 "2016-11-26T15:39:49Z")

</div>

[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

```auto
    let uuid = UUID().uuidString // THIS IS NOT XOJO CODE... DO NOT PASTE INTO YOU XOJO PROJECT!!!!!!
```

---

<div class="post-metadata">

**Author:** ![Tim\_Parnell](https://forum.xojo.com/user_avatar/forum.xojo.com/tim_parnell/32/161_2.png) [@Tim\_Parnell](https://forum.xojo.com/u/Tim_Parnell)\
**Post date:** [November 26, 2016, 4:20pm UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/8 "2016-11-26T16:20:08Z")

</div>

I think he’s talking about the device UUID.

---

<div class="post-metadata">

**Author:** ![DaveS](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.xojo.com/u/DaveS)\
**Post date:** [November 26, 2016, 4:32pm UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/9 "2016-11-26T16:32:24Z")

</div>

> [@300161:@Tim Parnell](#):
>
> I think he’s talking about the device UUID.

ah… good point… my brain (and the code I posted) was to CREATE a UUID

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [November 26, 2016, 4:49pm UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/10 "2016-11-26T16:49:51Z")

</div>

I was talking indeed about the device UUID. Besides, getting that information from a Web app is AFAIK completely impossible anyway.

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [November 26, 2016, 6:36pm UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/11 "2016-11-26T18:36:28Z")

</div>

Change that one line into

dim TestableClasses() as Introspection.TypeInfo  
TestableClasses.Append GetTypeInfo(mojo.UUID)

---

<div class="post-metadata">

**Author:** ![Joseph\_Claeys](https://forum.xojo.com/user_avatar/forum.xojo.com/joseph_claeys/32/1104_2.png) [@Joseph\_Claeys](https://forum.xojo.com/u/Joseph_Claeys)\
**Post date:** [November 26, 2016, 7:25pm UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/12 "2016-11-26T19:25:01Z")

</div>

Norman FTW.

---

<div class="post-metadata">

**Author:** ![Norman\_P](https://forum.xojo.com/letter_avatar_proxy/v4/letter/n/858c86/32.png) [@Norman\_P](https://forum.xojo.com/u/Norman_P)\
**Post date:** [November 26, 2016, 7:41pm UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/13 "2016-11-26T19:41:02Z")

</div>

\<[https://xojo.com/issue/46009](https://xojo.com/issue/46009)\>

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:33pm UTC](https://forum.xojo.com/t/mojo-type-mismatch-charles-yeomans-code/34648/14 "2020-10-29T18:33:46Z")

</div>


