7

I cannot find this issue addressed in Apple documentation, Apple Forums, or stackOverflow. I have attempted to create code and look at results from various options.

It appears that if a sort descriptor is not provided the call to [PHAsset fetchAssetsWithLocalIdentifiers] returns the assets in local identifier order. Using the technique of passing "nil" for the options, I can replicate the sort order of existing PHAsset Collections.

    self.assetsFetchResults = [PHAsset fetchAssetsWithLocalIdentifiers:self.selectionList options:nil];

In the developer documentation, I cannot find an option for the sort descriptor for PHAsset that would override this default action to meet my needs. I am loading the assetsFetchResults into a transientAssetCollection which limits the addition and deletion of assets (per Apple documentation).

    self.assetCollection = [PHAssetCollection transientAssetCollectionWithAssetFetchResult:self.assetsFetchResults title:self.albumName];

Is there a way for fetchAssetsWithLocalIdentifiers to return the assets in the order of the local identifiers in the array supplied on the call? If the call would return assets in the order that the array is in, then the app could control the results...

Is there something that I missed in the documentation?

Thank you, Tony

Update: I have tried coding sort selector for the fetchAssetsWithLocalIdentifiers to override the sorting of the fetch results. BUT, even thought the Apple documentation indicates that "localIdentifier" is a valid key for PHAssets, the program fails due to invalid sort key.

McInvale
  • 158
  • 1
  • 10

0 Answers0