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