to pick the image i usedimport * as ImagePicker from 'expo-image-picker';
image pick process
const permission = await ImagePicker.requestMediaLibraryPermissionsAsync(); if (permission.granted === false) { Alert.alert('You did not accept access to internal storage'); } else { console.log(permission); const result = await ImagePicker.launchImageLibraryAsync({ mediaTypes: ImagePicker.MediaTypeOptions.All, allowsEditing: true, aspect: [4, 3], quality: 1, }); console.log(result); if (!result.cancelled) { const imageToUploadUri = result.uri; setImage(imageToUploadUri); Alert.alert('picture loaded now upload it to the storage'); } else { Alert.alert('You did not chose any image'); } } };
and the image is set successfully but when i am try to upload this image to firebase storage the app crash only on ios.
the firebase imports i used:
import firebase from 'firebase/compat/app';import { getDownloadURL, getStorage, ref, uploadBytes } from 'firebase/storage';
// image upload functionexport const uploadImage = async (url: string, clubName: string) => { const storage = getStorage(); const reffernce = ref(storage, `home_image/${clubName}_main.png`); const image = await fetch(url); const bytes = await image.blob(); await uploadBytes(reffernce, bytes);}