question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CameraRoll.getPhotos return just a few on iOS

See original GitHub issue

Environment

Environment: OS: Linux 4.15 Node: 10.6.0 Yarn: 1.7.0 npm: 6.1.0 Watchman: Not Found Xcode: N/A Android Studio: Not Found

Packages: (wanted => installed) react: 16.3.1 => 16.3.1 react-native: https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz => 0.55.4

Description

The CameraRoll.getPhotos function only returns some photos on iOS, while it works perfectly on Android. For example, if I use the following parameters

{
  first: 100,
  assetType: 'All',
  groupTypes: 'All',
}

I only get 39 photos, while I have more than a thousand in my camera roll. I have also tried with multiple different parameters, but the result is the same (or fewer photos because of a filter).

Reproducible Demo

https://snack.expo.io/Hyw-kQa4X

  • I think it must be run on a physical iOS device, because it has to access the camera roll.
  • The demo prints the length of response.length, where response is the resolved value of CameraRoll.getPhotos with the parameters I mentioned earlier.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:6
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
airlasercommented, Dec 13, 2018

Unless people’s environments are starkly different from mine the switch will fix it. My app uses PHPhotoLibrary’s PHAsset.fetch to get the IDs using bridge Swift code, then string manipulation to turn them into ALAssetsLibrary style URIs.

Everything else in React (Image tag, upload libraries, custom image tags, etc) will work just fine with ALAssetsLibrary URIs even if CameraRoll couldn’t find them to begin with. They will not work with PHAssets. Live photo/burst get treated as their key frame single image.

I think the harder part of switching CameraRoll over is that everything else in React has to follow suit. It will require switching CameraRoll to have an option for whether it gives PHAssets or ALAssets, even if the only difference ends up being some string manipulation of the URI format.

@hramos What is the process for getting something like that done? I’ve never worked on React Native itself before.

1reaction
bartolkaruzacommented, Mar 31, 2019

On top of that, it seems that Image still does not work with photos://uuid URIs given by PHAsset and on some models of phone assets-library://uuid URIs have stopped working.

@airlaser Can you post these as separate issues please? No-one is tracking this closed issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native CameraRoll.getPhotos API doesn't render the ...
So I resolved this issue. The main reason for my problem was I was not using CameraRoll.getPhotos properly as a Promise.
Read more >
@react-native-camera-roll/camera-roll - npm
CameraRoll.getPhotos(params);. Returns a Promise with photo identifier objects from the local camera roll of the device matching shape ...
Read more >
CameraRoll - React Native Archive
getPhotos (params);. Returns a Promise with photo identifier objects from the local camera roll of the device matching shape defined by getPhotosReturnChecker ....
Read more >
How to transfer photos from iPhone to PC – 8 ways - CopyTrans
How to get photos off iPhone using Windows Explorer ... This method is very slow though, unless you need to transfer only a...
Read more >
Automatically save photos and videos with OneDrive on iOS
The camera roll on your device only uploads to OneDrive - it does not sync photos ... If automatic camera upload isn't working,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found