Android: `withMediaPicker(type: .library)` returns an uncopied `content://` URI that Skip Fuse apps cannot read
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 78/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Swift
- Estrellas
- 11
- Forks
- 11
- Merge medio
- 10 h 17 min
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de skiptools/skip-kit
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
Todos los issues de skiptools/skip-kit
Issues similares
-
AndroidAssetManager(env:peer:) in AssetURLProtocol.swift doesn't compile for Android on the Swift nightlyPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
erkamyaman/unslop-anything#579 ·
Los mantenedores suelen responder en 1 día
-
good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
erkamyaman/rust-anything#1311 ·
Los mantenedores suelen responder en 1 día
-
Android: a long press's `contextmenu` event carries no point (`clientX` and `clientY` are 0)Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug priority:low status:queued
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día