GithubHelp home page GithubHelp logo

importexport's Introduction

A.C. Wright

Banner

🚀 About Me

I'm a Software Developer, YouTuber, and Blogger from Lincoln, NE

You can contact me at [email protected]

🍺 Support Me

Buy me a coffee (or beer): https://paypal.me/acwrightdesign

🔧 Technologies & Tools

importexport's People

Contributors

acwright avatar leonboe1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

importexport's Issues

Not working on real device?

This is a great implementation of the recently announced fileImporter -- thank you!

I've made some modifications for my own code, and find that it runs fine on an iPad/iPhone simulator, but fails on a real device.

So then I downloaded your original code, and found the same behavior: it works on the simulators, but fails on the real device.

By adding 2 lines, under the // Handle failure comment near the end of the .fileImporter block of code:
.fileImporter(
isPresented: $isImporting,
allowedContentTypes: [.plainText],
allowsMultipleSelection: false
) { result in
do {
guard let selectedFile: URL = try result.get().first else { return }
guard let message = String(data: try Data(contentsOf: selectedFile), encoding: .utf8) else { return }

            document.message = message
        } catch {
            // Handle failure.
            print("Unable to read file contents")
            print(error.localizedDescription)
        }
    }

I find that there are file permission errors with the real devices:
Unable to read file contents
The file “Message.txt” couldn’t be opened because you don’t have permission to view it.

I've tried this on iPadOS 14.2 beta, and iPhone 14.01. Am I misusing this, or is this an Apple bug?

The file “XY.txt” couldn’t be opened because you don’t have permission to view it.

For me, the app works on the simulator but when I test it on a real device, I will get the error message The file “XY.txt” couldn’t be opened because you don’t have permission to view it. if I include print(error.localizedDescription) to the catch part of the .fileImporter. So importing files doesn't work at all. Exporting files works fine however. (Tested with both iOS 14 and 14.2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.