Hi, Below I am going to put, my code, as I say, in the breakpoints everything works fine, it does not show any errors, it simply does not load the file, nor does its name appear, when I pass it to testfligh and install it,
Button("Choose File") {
mostrarSelectorPDF1.toggle() }
.padding()
.fileImporter(isPresented: $mostrarSelectorPDF1, allowedContentTypes: [UTType.pdf], onCompletion: { result in
do {
guard let archivoURL1 = try result.get() as? URL else {
return
}
let archivoData = try Data(contentsOf: archivoURL1)
archivoPDF1 = archivoData
nombreArchivo1 = archivoURL1.lastPathComponent
print("File: (archivoURL1)")
} catch {
print("Error al encontrar la ubicación del archivo: (error.localizedDescription)")
}
})
if !nombreArchivo1.isEmpty {
Text("Selected File: (nombreArchivo1)")
} else {
Text("No file selected")
}
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: