Android: `withMediaPicker(type: .library)` returns an uncopied `content://` URI that Skip Fuse apps cannot read
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 78/100
Direzione di ricerca
Read the .library and multi-select branches in MediaPicker.swift, then compare them with the copy branch in DocumentPicker.swift. Trace how the picker result URI is opened and how the cache file URL is returned. Done when Data(contentsOf:) can read the selected image in a Skip Fuse Android app; the issue names no test to run.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
skip-kit version: 1.1.5 (same code in 1.0.0)
What happens. On Android, the .library branch of MediaPicker.swift passes the photo picker's result straight
through:
selectedImageURL.wrappedValue = URL(platformValue: java.net.URI.create(uri.toString()))
That is a content://media/picker_get_content/… URI. In a Skip Fuse app, Foundation is native, and native
Data(contentsOf:) has no content-resolver path. So reading the picked image fails, and uploading or processing it
is impossible without the app writing its own ContentResolver bridge. On iOS the same API returns a file:// URL,
so cross-platform code that works on iOS silently fails on Android.
Expected. The same contract as DocumentPicker. It already opens the URI through context.contentResolver,
copies it into cacheDir under a safe name and returns a file:// URL (DocumentPicker.swift, the copy branch).
Doing the same in the .library (and multi-select) branches of MediaPicker would make the returned URL readable
from native Swift on both platforms.
Steps to reproduce.
- In a Skip Fuse app, attach
.withMediaPicker(type: .library, isPresented:, selectedImageURL:). - Pick a photo on an Android device (Pixel 5, Android 14, system photo picker).
try Data(contentsOf: selectedImageURL)throws; the URL's scheme iscontent.
Workaround we ship. A per-app adapter: native Swift, AnyDynamicObject calls to getContentResolver(),
openInputStream, FileOutputStream and android.os.FileUtils.copy, copying into the cache directory before the
URL is used. We would like to delete it once the picker copies.
- Lingua principale
- Swift
- Stelle
- 11
- Fork
- 11
- Merge medio
- 10h 17m
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di skiptools/skip-kit
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
Tutte le issue di skiptools/skip-kit
Issue simili
-
AndroidAssetManager(env:peer:) in AssetURLProtocol.swift doesn't compile for Android on the Swift nightlyForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
erkamyaman/unslop-anything#579 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
erkamyaman/rust-anything#1311 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug priority:low status:queued
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
I maintainer di solito rispondono entro 1 giorno