MediaLibrary.createAssetAsync crashes Expo on iOS

I am trying to use Media Library to save camera photos to the gallery. It works fine on Android. On iOS, calling MediaLibrary.createAssetAsync crashes the app. I am running it through the Expo app, not as a standalone build. This can be easily reproduced through this snack iOS createAssetAsync Crash - Snack or by running create-react-native-app and replacing App.js with the following code.

import React from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
import { Constants, Camera, FileSystem, Permissions, SQLite, ScreenOrientation, KeepAwake, GestureHandler, Video, MediaLibrary } from 'expo';

export default class App extends React.Component {

  componentDidMount = async () => {
    await Permissions.askAsync(Permissions.CAMERA);
    await Permissions.askAsync(Permissions.CAMERA_ROLL);
  takePhoto = () => {
    setTimeout(() => {
      console.log('timeout'); data => {
        console.log('read to create assset');
        const asset = await MediaLibrary.createAssetAsync(data.uri);
        console.log('successfully created asset');
    }, 3000);   
  render() {
    return (
      <View style={styles.container}>
		    <Camera ref={ref => {
   = ref;
          }} style={{flex:1, width: '100%'}}>
        <Button title="Take Photo" onPress={this.takePhoto}></Button>    

const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',

Does anyone see anything that I am missing? I am using Expo SDK 27.0.1.

1 Like

I have the same issue. No error, the app just crashes and closes

Thanks for the snack and report, this looks like a bug and we will get on it immediately.

1 Like

We’ve merged a fix for this which will ship in our next minor release.

1 Like

Awesome. Thank you (and bacon) for the quick response.

1 Like

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.