MediaLibrary.getAssetsAsync not working in built app

Hi, I recently upgraded to SDK42. No issues. Did a new build for iOS, loaded on tetflight and MediaLibrary.getAssetsAsync stopped working. The refreshing state variable is never set to false and no image is rendered. The below code works without a single issue on the expo client! It’s related only to the build.

Thanks for any help

  getAssetsFromMediaLibrary() {
    const { after, media, totalMediaCount } = this.state;

    // Initial call need to be taken in account
    if (totalMediaCount !== 0 && media.length >= totalMediaCount) {
      console.log('No more assets to load');
      return;
    }
    MediaLibrary.getAssetsAsync({
      first: assetsPerPage,
      after,
      mediaType: [MediaLibrary.MediaType.photo],
      sortBy: [MediaLibrary.SortBy.default],
    }).then((newlyLoadedMedia) => {
      this.setState({
        media: mergeWithoutDuplicates(media, newlyLoadedMedia.assets),
        after: newlyLoadedMedia.endCursor,
        totalMediaCount: newlyLoadedMedia.totalCount,
        refreshing: false,
      });
    })
  }

Diagnostics:


  Expo CLI 4.11.0 environment info:
    System:
      OS: macOS 10.15.7
      Shell: 5.7.1 - /bin/zsh
    Binaries:
      Node: 14.16.0 - /usr/local/bin/node
      Yarn: 1.22.5 - /usr/local/bin/yarn
      npm: 7.20.6 - /usr/local/bin/npm
      Watchman: 4.9.0 - /usr/local/bin/watchman
    Managers:
      CocoaPods: 1.8.4 - /usr/local/bin/pod
    SDKs:
      iOS SDK:
        Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
    IDEs:
      Android Studio: 3.6 AI-192.7142.36.36.6241897
      Xcode: 12.4/12D4e - /usr/bin/xcodebuild
    npmPackages:
      expo: ^42.0.0 => 42.0.3 
      react: 16.13.1 => 16.13.1 
      react-dom: 16.13.1 => 16.13.1 
      react-native: https://github.com/expo/react-native/archive/sdk-42.0.0.tar.gz => 0.63.2 
      react-native-web: ~0.13.12 => 0.13.18 
      react-navigation: ^4.4.4 => 4.4.4 
    npmGlobalPackages:
      expo-cli: 4.11.0
    Expo Workflow: managed

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