olofd/react-native-photos-framework

No meta data returned when calling getAssets

hanseklund opened this issue · 2 comments

On a fresh project:

RNPhotosFramework.getAssets({
        includeMetaData: true,
        startIndex: 0,
        endIndex: 100,
        fetchOptions : {
          mediaTypes: ['image'],
          sourceTypes: ['userLibrary'],
          sortDescriptors : [
            {
              key: 'creationDate',
              ascending: true,
            }
          ],
        }
      }).then((data) => {
        console.log('FETCHED DATA:',data);
      }, (e) => {
        console.log('ERROR:',e);
      })

Array of ImageAssets are returned, but no creationDate or modificationDate.
NSLog of params in getAssets on iOS native code(RNPFManager.m):

{
    assetDisplayStartToEnd = 1;
    endIndex = 100;
    fetchOptions =     {
        mediaTypes =         (
            image
        );
        sortDescriptors =         (
                        {
                ascending = 1;
                key = creationDate;
            }
        );
        sourceTypes =         (
            userLibrary
        );
    };
    includeMetaData = 1;
    startIndex = 0;
}

..but all the following RCTConvert calls seems to resolve to null, including this:

BOOL includeMetadata = [RCTConvert BOOL:params[@"includeMetadata"]];

My Objective C skills are limited so didn't manage to solve this. Hopefully my javascript call above is correct.
Tested on React Native 0.41.0 (and 0.43.1) using react-native-photos-framework 1.0.1

Ok, so this was my mistake.
It should be 'includeMetadata' (lower case d) and not 'includeMetaData'.

Our implementation broke when upgrading from 0.0.64 to a newer version, so it seems like that's when the implementation switched to lower case d.

Thanks for all your great work.

olofd commented

@hanseklund Yes! Sry about that. Changed to Metadata to be more englishly-correct.