PHFetchOptions.includeHiddenAssets does not correctly return asset by id

When attempting to access a PHAsset that is in the hidden folder of iOS26, the PHFetchResult always returns no items, even when the user has granted full access to photos and even when includeHiddenAssets is true.

This is the code suggested by ChatGPT; it always fails:

public func fetchAsset(withLocalIdentifier identifier: String) -> PSSPHAssetImplementing? {
    // First try the direct fetch by identifier (fast path)
    let directResult = PHAsset.fetchAssets(withLocalIdentifiers: [identifier], options: nil)
    if let asset = directResult.firstObject {
        return build(from: asset)
    }

    // Fallback: fetch all assets including hidden, then filter manually
    let options = PHFetchOptions()
    options.includeHiddenAssets = true
    let allAssets = PHAsset.fetchAssets(with: options)

    for index in 0..<allAssets.count {
        let asset = allAssets.object(at: index)
        if asset.localIdentifier == identifier {
            return build(from: asset)
        }
    }

    return nil
}

Is it no longer possible to retrieve a hidden photo in iOS 26?

The behavior changed in iOS 16. See this excerpt from the developer documentation for more information:

Beginning with iOS 16, users can require authentication to view the hidden album, and the user setting is true by default. When true, the system doesn’t return hidden assets even if the includeHiddenAssets fetch option is true. If you use PhotosPicker, a user can choose hidden assets to provide to your app.

https://developer.apple.com/documentation/photos/phasset/ishidden

PHFetchOptions.includeHiddenAssets does not correctly return asset by id
 
 
Q