What sort of assets does PHAssetMediaTypeAudio fetch?
Asked Answered
E

0

6

I am testing PHAsset more particularly the following method:

+ (PHFetchResult *)fetchAssetsWithMediaType:(PHAssetMediaType)mediaType
                                options:(PHFetchOptions *)options

I am unclear what PHAssetMediaTypeAudio and fetchAssetsWithMediaType:PHAssetMediaTypeUnknown actually retrieve. This is my test code for illustration:

- (void)testRetrieveAssetsFromPhotoLibrary {

   // this gets me photo library images
   PHFetchResult *imagesResults = 
     [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeImage options:nil];
   NSLog(@"Number of images: %i", (int)imagesResults.count);

   // this gets me photo library videos
   PHFetchResult *videoResults = 
     [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeVideo options:nil];
   NSLog(@"Number of video files: %i", (int)videoResults.count);

   // what does this get me??  
   // not iTunes sync'ed music nor Voice Memo recordings...
   // prints 0...
   PHFetchResult *audioResults = 
     [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeAudio options:nil];
   NSLog(@"Number of audio files: %i", (int)audioResults.count);

   // what does this get me too??
   // prints 0...
   PHFetchResult *otherResults = 
     [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeUnknown options:nil];
   NSLog(@"Number of other files: %i", (int)otherResults.count);

}
Erleneerlewine answered 7/6, 2015 at 20:23 Comment(6)
Did you find an answer to this?Premaxilla
frankly I'm still puzzled by thisErleneerlewine
I was thinking maybe it's the voice recordings, but a. there is no privacy setting for that, and b. no actual API to support such assets. Guessing experimental stuff that either Apple forgot to remove or for future compatibility.Premaxilla
if I had to take a guess now, I'd say this fetches any audio file that somehow got stored into Photo Library.. how one gets an audio file there is a different question..Erleneerlewine
The unknown type might return items that are stored in iCloud but not available locally, perhaps?Tollman
It could possibly be the individual assets that make up a Live PhotoRoane

© 2022 - 2024 — McMap. All rights reserved.