Compiler error on FolderItem (Xojo.IO.FolderItem)

Hi Everyone,

Help please. Editing an iPad app in Xojo 2025 r1.1. I paste the following example code (below) directly out of the Xojo PDFDocument documentation into the iPad app, and a compiler error results on build (below). I’ve looked everywhere for a solution and tried a dozen different things… any insight would be appreciated.

Var pdf As New PDFDocument
Var g As Graphics = pdf.Graphics
g.PenSize = 1
g.DrawLine(0, 0, 0, 324)
g.DrawLine(0, 324, g.Width, 324)

Var r As New Random
Var startX As Integer = 1
Var colors() As Color
Var bars() As Integer

If colors.LastIndex = -1 Then
For n As Integer = 0 To 5
colors.Add(Color.RGB(r.InRange(0, 255), r.InRange(0, 255), r.InRange(0, 255)))
bars.Add(r.InRange(325 * 0.1, 325 - 325 * 0.2))
Next
End If

Var barWidth As Integer = g.Width / 6 * 0.8
Var spaceBetween As Integer = g.Width / 6 * 0.2
For n As Integer = 0 To 5
g.DrawingColor = colors(n)
g.FillRectangle(startX, 325 - bars(n), barWidth, bars(n) - 1)
startX = startX + barWidth + spaceBetween
Next

Var f As FolderItem = SpecialFolder.Documents.Child(“Barchart.pdf”)
pdf.Save(f)

** Build error:

Parameter “f” expects class FolderItem, but this is class Xojo.IO.FolderItem.

How do I satisfy the compiler so that it will save this pdf?

Do you have somewhere a Using Clause in your project with Xojo.IO?

Thank you. Yes, in code executed before this method, I have

Using Xojo.Math

Do you think that’s the cause?

Somewhere you have one for Xojo.IO. that needs to be removed. Xojo.IO.Folderitem no longer exists in iOS IIRC

Thank you both. I’ll rip out instances of Xojo.IO.Folderitem when I’m back programming in two days and see if it fixes it. After a quick search, it looks like I have two places that may be a problem… that make reference to Xojo.IO.FolderItem:

IN an HTTPSocket…

FileReceived(URL as Text, HTTPStatus as Integer, File As Xojo.IO.FolderItem)

and in a Try-Catch…

Catch error As Xojo.IO.IOException

Fingers crossed. :slight_smile:

You need to be using URLConnection instead of the namespaced HTTPSocket

Hi Tim,

Thank you for that advice. I appreciated it.

I had to finish the project, so I tweaked the code to get around the compiler errors. Never did figure out why it was objecting… couldn’t figure out why it interpreted folder items as xojo.io.folderitem when the constructor used was for FolderItem. In any case, the project got finished on time and successfully.

Since then I’ve finally found the time to do what you suggested and use URLConnection, but also got all of my iPad app code up to API 2.0. One poster I read here in the Forum, in commenting on the time necessary to update all of an iPad app’s code from API 1.0 to API 2.0, said it took half the time necessary to write the code in the first place. I didn’t find it nearly that time consuming, but it did take me about 90 hours over a 7-day stretch. It is definitely a big hill to climb.

Thanks for the pointers. Sincerely, Mike.