Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

481
Visualizações
Cannot open file from iOS Files app via the Open In <My App> share sheet: no file at the provided file URL exists

My iOS app can open CSV files, in order to import their data. I can open files from within the app via a UIDocumentPickerViewController with no issues, selecting a file shown in the Files app. However, when viewing a file in the Files app first, and then opening my app from there (via the Open In share sheet), my app cannot see the file at the URL passed to my app. The file does not seem to exist.

I added the following debug code to my AppDelegate:

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
    print("Exists: \(FileManager.default.fileExists(atPath: url.path)) (\(url.path))")
    return true
}

When I open a file from Files in this app, it results in a log line like:

Exists: false (/private/var/mobile/Library/Mobile Documents/com~apple~CloudDocs/Reading List - Andrew’s iPhone - 2018-10-18 11-19.csv)

When I open a file from some other app (e.g. Dropbox, or from an Email), the file can be processed, and the following is logged:

Exists: true (/private/var/mobile/Containers/Data/Application/F9110F90-7A91-4AB6-A92E-0ED933184EA4/Documents/Inbox/Reading List - Andrew’s iPhone - 2018-01-27 08-03.csv)

Note the different path (Documents/Inbox vs Mobile Documents/com~apple~CloudDocs). What is causing this? How can I support the opening of files from the Files app in my app?

The document type(s) supported by my app are as follows:

Xcode document types

over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

I fixed this by adjusting some settings in the app's Info.plist.

I switched UISupportsDocumentBrowser to false, and added LSSupportsOpeningDocumentsInPlace, also set to false.

I think these settings were set incorrectly (by me) after I received an email from App Store Connect stating:

Invalid Document Configuration - Document Based Apps should support either the Document Browser (UISupportsDocumentBrowser = YES) or implement Open In Place (LSSupportsOpeningDocumentsInPlace = YES/NO). Visit https://developer.apple.com/document-based-apps/ for more information.

over 4 years ago · Santiago Trujillo Relatório

0

Setting the LSSupportsOpeningDocumentsInPlace flag to false prevents the app to be automatically opened when selecting the file in the Files App. In case the the file is opened in place one needs to request/unlock access first:

 func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {     
   let opensInPlace = options[.openInPlace] != nil
   opensInPlace ? url.startAccessingSecurityScopedResource() : nil
   let fileExists = FileManager.default.fileExists(atPath: url.path)  
   opensInPlace ? url.stopAccessingSecurityScopedResource() : nil
 }
over 4 years ago · Santiago Trujillo Relatório

0

I don't think you can share files between different apps (that are not in the same app group):

Sharing data between apps on iOS

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda