Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way to approve carnets to access file folder #316

Open
abazeman opened this issue Oct 29, 2023 · 25 comments
Open

No way to approve carnets to access file folder #316

abazeman opened this issue Oct 29, 2023 · 25 comments

Comments

@abazeman
Copy link

I image

Anyone knows how to get iPhone to allow Carnets to access files and create new files? The app did not ask permission and I do not know how to grant it permission without the prompt

@holzschu
Copy link
Owner

I think the first question is: where are you creating the file? in which folder?

@nedgar
Copy link

nedgar commented Jan 4, 2024

I'm seeing something similar after first install of Carnets on iOS 17.2.1. It's acting as if Files and Folders permission has not been granted, and I don't see the option to grant that. Perhaps the app's manifest doesn't declare that requirement?

New notebook (+ icon):

image

Trying to open Welcome notebook in Carnets folder:

image

@holzschu
Copy link
Owner

holzschu commented Jan 4, 2024

Thanks a lot for the screenshots. I'm extremely puzzled (also because it does not happen often, especially not when I'm testing).

In the AppStore reviews, someone mentionned that changing the "Document Storage" option for Carnets in the Settings App to "On my iPhone" instead of "iCloud Drive" solved this issue.

@nedgar
Copy link

nedgar commented Jan 4, 2024 via email

@holzschu
Copy link
Owner

holzschu commented Jan 5, 2024

That would be great. Let me have a look at the code first to identify possible causes. Do you have access to the local directories ("on my iPad/Carnets", or "on my iPad/Another App")?

@nedgar
Copy link

nedgar commented Jan 5, 2024 via email

@holzschu
Copy link
Owner

holzschu commented Jan 5, 2024

Are you telling me that Carnets can not even create a notebook inside "On my iPad/Carnets"? (and if so, could you send me a screenshot, so I can escalate the issue with Apple?)
Also, what do you mean by "Looks like it’s trying to read from iCloud documents folder, not local Carnet folder"?

@nedgar
Copy link

nedgar commented Jan 6, 2024

My mistake, I assumed it was trying to use an iCloud/Carnets folder because the URL shown in the error dialog was file:///private/var/mobile/Library/Mobile%20Documents/iCloud~AsheKub~Carnets/Documents/welcome/Welcome to Carnets.ipynb, but I guess iCloud~AsheKub~Carnets is just a way of identifying you as owner of the Carnets folder in local Files/Folders on device.

I tried uninstalling / reinstalling the Carnets app. The Carnets folder was deleted (or hidden) on uninstall. After reinstall, it reappeared but empty. I am now able to create a notebook, evaluate an expression, and save the notebook. If I try Save As, the prompt for path name has: private/var/mobile/Containers/Data/Applicaton/<UUID>/Documents/Untitled. If I accept, then it is saved OK and shows as Untitled.ipynb under On My iPhone/Carnets.

The path above is different than that in the URL from the error dialog.

Also, I don't see any way to access the Welcome notebook. Is it normally added to the local Carnets folder under Documents/welcome?

@nedgar
Copy link

nedgar commented Jan 6, 2024

I've copied the welcome/* files from the repo to a new Carnets folder in iCloud, and tried to open the welcome notebook from there. It opens OK but gives the warning about not having access to the "directory around this notebook" (wording suggestion: "the containing directory"). I don't see any "unlock directory" label, but the rightmost button in toolbar, with folder icon and arrow (suggesting import), allowed me to "open" the welcome folder. It then restarted the server / reloaded the page, with images showing.

@tonydavidcray
Copy link

Just found Carnets and am keen to get it running, but can confirm the exact same issues as **nedgar **

@holzschu
Copy link
Owner

holzschu commented Jan 9, 2024

Please keep sending detailed description of the issue, with the location of the directory with the issue and screenshots showing the error messages (also, what system version are you using). If it's an issue with iCloud access, it's different from an issue with access to local folders. From your descriptions, it's an issue that happens randomly, and from what I can see there's Apple software that behaves differently from what its documentation says. Any kind of hint can help in understanding where the issue is and how to work around it.

@nedgar
Copy link

nedgar commented Jan 9, 2024

@tonydavidcray good to have your input too. Does reinstalling Carnets help?

@tonydavidcray
Copy link

Deleting and reinstalling resulted in a little more progress. Still seems to be some odd issues with permissions with the file manager.

I have now successfully adding a .ipynb file to my icloud drive from VSCode on my mac. File is able to be opened on Carnets and runs as expected. Saving on iPad also now syncs to the mac Cloud Drive and updates in VSCode.

@tonydavidcray
Copy link

Creating a new notebook on iPad still results in a permissions error.
iPad M1 12.9”.
iPadOS 17.1.2

@holzschu
Copy link
Owner

Hi,
the TestFlight version of Carnets-with-Scipy: https://testflight.apple.com/join/UbNIjkjp
has changed how it access files in "iCloud folder/Carnets" and also prints more information about why the access fails. Could you please test it and report the error?

@nedgar
Copy link

nedgar commented Jan 27, 2024

Looks good! I shared a few screenshots with suggestions. Lmk if you didn't get them.

@holzschu
Copy link
Owner

I'm glad to know it works for you; I didn't get the screenshots. If the github user interface keeps removing them, you can send them by e-mail to: carnets_jupyter@icloud.com

@nedgar
Copy link

nedgar commented Jan 28, 2024

I meant I sent the screenshots from the in-app hook.

@holzschu
Copy link
Owner

Oh! Thank you, I got them.
Most of your suggestions are about things that are not under my control. In short: iOS has a strong file security. An app cannot access a file from another app, unless the user explicitly grants permission. Clicking on the file is granting permission. But that means that the file browser you see at the beginning is not something that the app can control, it's something managed by the system (Carnets calls it, but that's all it can do). I could not find any ways (so far) to guide this file browser, for example by telling it to open a specific directory or to not start with "Recents". I'd love to, but there are no documented calls for that. I've been trying for years, I tried again in the past weeks, nothing works.
And to answer your other question: when you clicked on a file, you granted permission for that file only. So you can edit its content (good) but not read files nearby, or create new files, or even rename the file. All of that requires folder permission, which you need to grant separately.

@nedgar
Copy link

nedgar commented Jan 28, 2024

Thanks for clarifying the constraints you have to deal with. I think the "directory around this file" warning could be clarified, but the behaviour makes sense now. Maybe just "other files in the containing folder cannot be accessed unless you grant permission". Note that the files app uses "folder" rather than "directory".

@nedgar
Copy link

nedgar commented Jan 28, 2024

Do you plan to release this "with scipi" version as a separate app or just as an upgrade?

@nedgar
Copy link

nedgar commented Jan 28, 2024

I'm also wondering what the UX for the welcome notebook is intended to be. I was only able to get it by copying from the repo. I'd expect it to appear in the Carnets folder, added in app install or on first run.

@holzschu
Copy link
Owner

Hi,
to answer your questions:

  • Carnets-with-Scipy is a separate app, it has been available on the AppStore for a few years. The two apps share the same user interface, the only difference is the number of packages installed (Carnets-with-Scipy has, well, scipy, but also packages that require scipy like seaborn, cartopy, coremltools, scikit-learn...) and the TestFlight approval status (it takes time to approve a new TestFlight version after a release, in that case Carnets-with-Scipy was already approved).
  • the welcome directory is supposed to be copied in the "iCloud/Carnets" folder when Carnets starts, in order to provide help for new users. I'm not sure why it hasn't been created in your case.

@Eiche63
Copy link

Eiche63 commented Apr 29, 2024

Hi, I‘ve got the same problem after downloading version 1.8.3 from the App Store (iOS Version 17.4.1 on M1 iPad). After the first start I saw an error message briefly appearing stating „You have no permission to create a Documents folder“ (or documents?), before the other error messages already reported in this thread to Carnets popped up. I renamed the Documents folder inside the app, could then create a notebook, start Python etc. That means, that after installing the welcome folder was NOT copied to „iCloud/Carnets“.

But I could not restart the app, had to reboot the iPad for that. Now a have an uploading problem to iCloud, the synchronization is stuck (which is imo connected to creating an illegal folder in the iCloud). I removed the app, deleted my notebooks and copies, and downloaded it again. Now I get only a blank screen which disappears after some seconds. The app seems still to be alive, can switch to a blank screen. Will try to disconnect from iCloud and reconnect.

@holzschu
Copy link
Owner

Hi,
you're the first to report the issue with version 1.8.3.
The first error message should have been something like: "Could not access iCloud: Carnets is unable to access your iCloud folder: (...)", or maybe "Error accessing iCloud: ...".

It's clear that iCloud does not like people creating or removing folders in its place. I actually don't understand how you could "rename the Documents folder inside the app". I'm going to see if your crash reports appear in my console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants