-0.4 C
New York
Saturday, February 22, 2025

swift – Created Information and Directories not exhibiting underneath “On My iPhone” on iOS 18


In an iOS challenge, constructed by way of XCode with react-native-fs bare-workflow, leveraging the latest iOS 18 iPhone Simulator:

To say prematurely: This difficulty appears to be completely new to the discharge of iOS 18, as different Builders report it functioning simply wonderful with earlier variations, comparable to 17, 15 and so forth.

Clarification

Utilizing react-native-fs, the applying let’s the consumer choose a folder by way of the native file-picker with const res = await DocumentPicker.pickDirectory();, which for our case is within the “On My iPhone” listing of the iPhone-Simulator. Then

const create = async (path: string, content material: string): Promise => {
    await RNFS.exists(path);
        if(!exists){
            await RNFS.mkdir(`${path}Listing`); // the "path" string already comprises "/" on the finish
            await RNFS.writeFile(`${path}Listing/file.{format}`, content material, 'utf8');
        }
}

generates a test-file on the given, chosen location, which is effortlessly created and capable of be considered, if I open it by way of my terminal within the given repository ~ % open {theSelectedFilePath/Listing}. Nevertheless, I can not see the generated information bodily within the iPhone Simulator’s file-app, underneath “On My iPhone”. They exist, however will not be proven within the given listing.

There are a number of inquiries discussing the identical difficulty:

There are present Apps, who’ve already solved this drawback of their system, comparable to Obsidian.md, for instance, which’s complete file-structure is regionally file-based, saved to the outlined listing on the iPhone, and visual contained in the Information-App.

The widespread fixes up till now had been:

1. To set the next settings to true in information.plist both by way of XCode, or the file itself:

LSSupportsOpeningDocumentsInPlace

UIFileSharingEnabled

2. To have at the least one file within the created Listing, for it to be considered, which we achieved by way of my instance above.

As my challenge makes use of a outside-the-sandboxed-directory strategy for file-management the answer to a extra widespread, sandboxed instance is definite to differ. There are not any Permission/Era points, as, if there have been, the file’s would not even be created on the first level.

Anybody right here, who has scavenged the suitable nook of the Apple-Dev-Docs, or has already discovered a solution? Many Thanks prematurely <3

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles