Working with deprecated types: Text and Xojo.io.folderitem

Hi,

I’m using iOSKit to send messages with attachements, and the iOSKit API requires deprecated Text and Xojo.io.folderitem types in some parameters, resulting in compile errors like:

Expected (Xojo.IO.FolderItem, Text, Text), but these arguments are (Folderltem, TextLiteral, String).

So, can I’d like to convert or cast them, but I’m having trouble.

And before I get to the Xojo.io.folderitem class, I’m trying to get String to Text conversion to work. Trying the obvious—assignment, assignment with typecast, doesn’t work:

Dim s0 As String = "Hello"
Dim s1 As Text

s1 = s0
Dim s0 As String = "Hello"
Dim s1 As Text

s1 = Text(s0)

I did try going into iOS and updating Text to String and Xojo.io.folderitem to FolderItem, but I think there are some compatibilty issues: Xojo.io.folderitem has a .Path property, which needs to be changed to .NativePath, and Text types are being used in declares that require CFStringRef types, and I’m unsure how XOJO handles Strings vs Text behind the scenes.

Thanks,
John

Try this:

Dim s0 As String = "Hello"
Dim s1 As Text

s1 = s0.ToText
1 Like

On the declares…

https://documentation.xojo.com/api/data_types/additional_types/cfstringref.html

Then it seems you can just pass string to the CFStringRef

2 Likes

Well, .ToText works!

I actually tried to look for such an autocomplete method, but none showed up:

image

John

Well of course not; Text is deprecated.

1 Like

You can make deprecated items visible in “Options/Coding/Show deprecated items”.

Thomas

1 Like

Thank you for that helpful tip. I’ve never used the deprecated API, but this working with this older framework is a good excuse to enable a feature I completely ignored.