RORK LABJP
BUILD — Rork generates native iOS/Android apps with React Native (Expo) from a plain-English description into deployable codeMAX — Rork Max outputs native Swift, targeting iPhone, iPad, Apple Watch, Apple TV, Vision Pro, and iMessageMAX — Real Swift output balances performance and App Store eligibility — currently the only tool doing thisDEPLOY — Shareable test links and automatic iOS/Android builds remove the need for separate build pipelinesPRICE — Free to start, with paid plans from $25/month — practical for solo devs from prototype to releaseFOCUS — Unlike web-first tools like Bolt or Lovable, Rork specializes in mobile appsBUILD — Rork generates native iOS/Android apps with React Native (Expo) from a plain-English description into deployable codeMAX — Rork Max outputs native Swift, targeting iPhone, iPad, Apple Watch, Apple TV, Vision Pro, and iMessageMAX — Real Swift output balances performance and App Store eligibility — currently the only tool doing thisDEPLOY — Shareable test links and automatic iOS/Android builds remove the need for separate build pipelinesPRICE — Free to start, with paid plans from $25/month — practical for solo devs from prototype to releaseFOCUS — Unlike web-first tools like Bolt or Lovable, Rork specializes in mobile apps
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.

Rork456Expo109iOS84Document 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-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.
Dev Tools2026-06-12
Adding a Home Screen Widget to a Rork App — Making WidgetKit Work Within Expo's Constraints
Rork generates Expo apps, and home screen widgets can't be written in React Native. Here's how to wire up WidgetKit with a config plugin and App Groups — including the parts that tripped me up.
📚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 →