◉RORK LABJP
●EXPO — EAS Observe now records native crashes (Oct 7). On SDK 57, update to 57.0.21 or later●SDK 58 — SDK 58 Beta has been out since Sep 15. The stable date is still unconfirmed●RN 0.88 — React Native 0.88.x is scheduled for Oct 12, 3 days left●Q&A — People are asking why expo-widgets render blank only in production builds●RORK — GPT-6.1 Sol was added on Sep 29, available on Pro and Max plans●NEW — Building an app for a client? Decide who owns the publishing account first●EXPO — EAS Observe now records native crashes (Oct 7). On SDK 57, update to 57.0.21 or later●SDK 58 — SDK 58 Beta has been out since Sep 15. The stable date is still unconfirmed●RN 0.88 — React Native 0.88.x is scheduled for Oct 12, 3 days left●Q&A — People are asking why expo-widgets render blank only in production builds●RORK — GPT-6.1 Sol was added on Sep 29, available on Pro and Max plans●NEW — Building an app for a client? Decide who owns the publishing account first
Articles/Dev Tools
⬡ Dev Tools/2026-06-26Advanced

Import the User's Own Image From the Files App in a Rork App, Without the URL Going Stale

Pull images from the Files app or iCloud Drive and the URL you picked goes invalid moments later. Here is how expo-document-picker, security-scoped URLs, and a reliable copy into your sandbox actually work, with running code.

Rork577Expo213iOS115Document PickerFile Management

✦ Premium Article

The line I wanted to add to my wallpaper app was simple: "You can use your own images too." It came after a user wrote in asking to edit a photo they had taken and use it as a wallpaper. If the picture lives in the camera roll, expo-image-picker is enough. But the images people actually want are not always in Photos. A design asset parked in the cloud, a single file received over AirDrop, a folder organized inside iCloud Drive. Those live in the "Files" app, not in "Photos."

So I added expo-document-picker, and selection worked on the first try. The problem showed up later: the imported image could not be opened the next day. The reason comes down to one fact. iOS does not hand you the real file inside the Files app. As an indie developer at Dolice, I hit these in a specific order, and this article walks through that same order: the minimal document picker, why the URL dies, copying reliably into the sandbox, and the native Swift route for Rork Max.

What the photo picker reaches, and where the file picker is needed

expo-image-picker works against the Photos framework, meaning the camera roll and albums. The "Files" app is a different entry point that spans On My iPhone, iCloud Drive, and third-party provider extensions like Dropbox or Google Drive.

The two also differ in their permission model. The photo picker copies the one item the user chose and hands it over, so your app needs no photo library permission. The document picker also grants access "only for the moment," but the way it does so is the catch. Since the target sits outside your app's sandbox, the URL has a lifespan. Save that uri without understanding this, and it will break on you.

The minimal expo-document-picker, and the first wall

Here is the straightforward version.

import * as DocumentPicker from 'expo-document-picker';
 
async function pickImageFromFiles() {
  const result = await DocumentPicker.getDocumentAsync({
    type: ['image/jpeg', 'image/png', 'image/heic'],
    copyToCacheDirectory: true,
    multiple: false,
  });
 
  if (result.canceled) return null;
 
  const asset = result.assets[0];
  // asset.uri / asset.name / asset.size / asset.mimeType
  return asset.uri;
}

With copyToCacheDirectory: true, Expo copies the file into your app's cache and returns a file:// URI. It displays fine. The trap is next. The cache directory (FileSystem.cacheDirectory) is a temporary area the OS may clear at any time, on storage pressure or during an app update. Persist that uri in AsyncStorage to restore "the same wallpaper next launch," and one day it simply will not read.

Set copyToCacheDirectory: false and you skip the copy for speed, but what comes back is a security-scoped temporary URL. It is valid only inside the selection callback, and is revoked the instant you carry it elsewhere. On Android you get a content://, also unfit for long-term storage.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦Why copyToCacheDirectory flips the behavior, and the documentDirectory rescue code that survives cache eviction
✦Handling startAccessingSecurityScopedResource and NSFileCoordinator correctly in Rork Max native Swift (iOS 16+)
✦Concrete fixes for not-yet-downloaded iCloud files, HEIC, oversized files, and multi-selection
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $15 for lifetime access
View Membership →

Related Articles

⬡ Dev Tools2026-09-21
A build that stops with exit code 0 — the flag that silenced the log, and the check that let an empty file through
Two reports landed in the same week: eas build --local stopping with exit code 0 but produced no further output, and a zero-byte stub that never got embedded. Both came down to settings that reduce output. Here is how to audit your own scripts.
⬡ Dev Tools2026-09-05
Your Widget Extension Can Submit a BGTaskScheduler Request. It Just Cannot Register the Handler
Calling BGTaskScheduler from a widget extension compiles, submits, and returns true — and then nothing runs. Here is why registration belongs to the host app only, and how I moved refresh ownership back where it belongs across my wallpaper apps.
⬡ Dev Tools2026-07-27
When to Raise Your Minimum iOS Version — Count Leftover Branches, Not User Percentages
Judging a minimum OS bump by usage share produces the same answer every year, so the decision never happens. Here is the annotation convention, the sweep script that counts how many iOS and Android branches each candidate floor would retire, and what to watch for 30 days after.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links