Questions tagged [phassetcollection]
31 questions
8
votes
4 answers
iOS PHAssetCollection localizedTitle always returning english name
I'm using Apples Photos Framework to load PHAssetCollections into my app.
I Always get the english name of the smart collections. For instance I get 'Favorites' instead of 'Favoriter' (Swedish). I thought the localizedTitle property would return the…

Objective Coder
- 557
- 3
- 11
- 23
6
votes
0 answers
Is there a way to speed up fetching PHAsset data like filesize?
We are developing a storage app that, among other things, syncs and backs up photos on the user's device with the cloud. We use the file size and image name together to form a makeshift hash for comparison.
The problem we are facing is when users…

Selim Savsar
- 61
- 2
6
votes
3 answers
estimatedAssetCount returns a wrong count
I need to display the camera roll album with the count of images in it. I'm using the below code to get the camera roll album.
let smartCollections = PHAssetCollection.fetchAssetCollectionsWithType(.SmartAlbum, subtype: .SmartAlbumUserLibrary,…

Isuru
- 30,617
- 60
- 187
- 303
5
votes
1 answer
PHAssets/PHAssetCollection/PHCollectionList and Folders
I am following Apple's Sample code 'ExampleappusingPhotosframework'.
In the subject of PHAssets/PHAssetCollection, I noticed there is the possibility of 'Folders' being present. These can appear from being created be Mac's Photo's App, or an older…

Gizmodo
- 3,151
- 7
- 45
- 92
4
votes
1 answer
iOS image picker is not showing images first time even after granting permission
When I fresh install the app and try to add photos even after granting the permission the image picker (I am using QBImagePickerController) can't load any albums or image. But if I terminate the app and relaunch it works. It's happening after iOS…

Rashad
- 11,057
- 4
- 45
- 73
4
votes
2 answers
Get screenshot (album) count in swift
I am new to Swift and am trying to make a function that simply returns the number of photos in your screenshot album using fetchAssetCollections
I have
func getNumScreenshots() -> Int {
let collection:PHFetchResult =
…

rjvalenti
- 53
- 6
4
votes
1 answer
PHCachingImageManager issue on iPad on iOS 9.3
Only on iPad devices and only in latest 9.3 release, when you call [PHCachingImageManager requestImageForAsset:] with a legitimate target size (CGSize) it does not return a valid image. For example...
PHAsset *asset =…

mutable2112
- 439
- 4
- 15
3
votes
2 answers
PHFetchOptions() Photos Only Using PHAsset & PHAssetCollection
I am using a chunk from Apple's sample code here:
override func awakeFromNib() {
// Create a PHFetchResult object for each section in the table view.
let allPhotosOptions = PHFetchOptions()
allPhotosOptions.sortDescriptors =…

Gizmodo
- 3,151
- 7
- 45
- 92
3
votes
0 answers
how to get all videos in photos library using PHAsset
how to get all videos in photos library using PHAsset.
NSArray* selectedMediaTypes = @[@(PHAssetMediaTypeImage)];
options.predicate = [NSPredicate predicateWithFormat:@"mediaType in %@", selectedMediaTypes];
options.sortDescriptors =…

Moaz Saeed
- 1,006
- 3
- 10
- 23
2
votes
1 answer
How to move reference of PHAsset from "All Photos"/"Camera Roll" to Specific PHAssetCollection?
I am using OpalImagePickerController to pick images/videos from "All Photos"/"Camera Roll" and it's giving me [PHAsset] which is fine but I wanted to add them to Specific album in Photos app and I am using below code for that:
@objc func…

Dharmesh Kheni
- 71,228
- 33
- 160
- 165
2
votes
1 answer
MacOS PhotoKit - List all user-created Smart Albums?
I've started playing around with macOS development for the first time. I'm trying to query the list of Smart Albums I've created in the macOS Photos app. As you can see in this screenshot, I've defined 18 Smart Albums and 1 regular Album. …

Shadowman
- 11,150
- 19
- 100
- 198
2
votes
2 answers
can't find Camera Roll album in Smart Album iOS 13
I ran into a problem. There were 15 albums for type smartAlbum in AssetCollection before iOS 13, but with iOS 13, the number became 14. Camera Roll disappeared from it.
Here Code of fetching albums:
func loadAlbums() {
var albums:[AlbumModel]…

Sergey Hleb
- 82
- 9
2
votes
0 answers
Sort smart albums using Photos Framwork - IOS / SWIFT
In my application there is a view which lists all the available albums in users photo gallery. There, I'm getting albums without any issue. but the order of smart albums is different from the photo gallery. I want the order as in the original photo…

Hanushka Suren
- 723
- 3
- 10
- 32
2
votes
1 answer
Fetching Assets using Asset resource failing with error "null"
My application reads photos and videos available in Camera Roll, using PHAssetResource application is fetching the original photo and video data. Below is the code used to retrieve the data from Camera Roll.
for (PHAssetResource *resource in…

Manikandan
- 107
- 2
- 12
2
votes
2 answers
PHAsset video get exifInfo (metadata)
I want to get Exif information for a video file.
Below is the code to get Exif for image but it doesn't seems to work for videos.
[[PHImageManager defaultManager] requestImageDataForAsset:photoAsset
…

Ekra
- 3,241
- 10
- 41
- 61