firebase-storage-upload-example
firebase-storage-upload-example copied to clipboard
Unhandled promise rejection: Error: Missing camera roll permission
Is there some code missing in the example? When I start the expo app for this project, it shows the buttons but when you tap on either one, it shows the following message:
[00:17:57] [Unhandled promise rejection: Error: Missing camera roll permission.]
- node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:123:42 in createErrorFromErrorData
- node_modules/react-native/Libraries/BatchedBridge/NativeModules.js:80:57 in <unknown>
- ... 5 more stack frames from framework internals
Is there some code missing that should be asking the user for permission to access the camera/camera roll before taking/picking a photo?
https://github.com/expo/expo/issues/1707
`import {ImagePicker, Permissions} from 'expo';
askPermissionsAsync = async () => { await Permissions.askAsync(Permissions.CAMERA); await Permissions.askAsync(Permissions.CAMERA_ROLL);
};
//打开照相机 useCameraHandler = async () => {
await this.askPermissionsAsync();
let result = await ImagePicker.launchCameraAsync({
// allowsEditing: true,
aspect: [1, 1],
base64: false,
});
if (!result.cancelled) {
}
};
<Button onClick={ this.useCameraHandler }>拍照</Button>`