RORK LABJP
ENGINE — Rork Max is powered by Claude Code and Claude Opus 4.6, generating native Swift apps directlyCORE ML — Rork Max reaches on-device Core ML inference alongside HealthKit, HomeKit, NFC, and App ClipsSEED — Rork raised a $15M seed led by Left Lane Capital in April 2026, joined by Peak XV and a16z SpeedrunM&A — Rork acquired the app builder Paperline and says it will stay acquisitive to bring in engineering talentMARKET — Gartner expects 75% of new applications to be built with low-code or no-code tools by the end of 2026GROWTH — The no-code AI platform market is projected to grow from $4.9B in 2024 to $24.8B by 2029ENGINE — Rork Max is powered by Claude Code and Claude Opus 4.6, generating native Swift apps directlyCORE ML — Rork Max reaches on-device Core ML inference alongside HealthKit, HomeKit, NFC, and App ClipsSEED — Rork raised a $15M seed led by Left Lane Capital in April 2026, joined by Peak XV and a16z SpeedrunM&A — Rork acquired the app builder Paperline and says it will stay acquisitive to bring in engineering talentMARKET — Gartner expects 75% of new applications to be built with low-code or no-code tools by the end of 2026GROWTH — The no-code AI platform market is projected to grow from $4.9B in 2024 to $24.8B by 2029
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.

Rork499Expo139iOS107Document 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 $10 for lifetime access
View Membership →

Related Articles

Dev Tools2026-06-29
Handling iOS Limited Photo Library Access in a Rork (Expo) App
Handle iOS limited photo library access (selected photos only) correctly in a Rork (Expo) app. Covers the three states of full / limited / denied, designing a screen that works from the selected subset, and a path to add more photos, all with working code.
Dev Tools2026-06-15
Putting a Working Button in a Rork App's Widget — Implementing App Intents So a Tap Acts Without Opening the App
How to put a button in a Rork-generated Expo app's widget that changes state without launching the app. We wire App Intents and WidgetKit together through an App Group, all the way to reloadTimelines — including the two places I lost real time.
Dev Tools2026-06-14
Actually Delivering 'It Updates Without Opening' in Expo — A Realistic Background Task Design
Building 'content refreshes every morning' into a Rork-generated Expo app runs into iOS background execution being far less dutiful than you expect. Here is a minimal expo-background-task setup plus a design that doesn't break when the task never runs.
📚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
See all →