iOS 17: Cannot find type 'PhotogrammetrySession' in scope (Object Capture)

Dear all,

I'm building a SwiftUI-based frontend for the RealityKit Object Capture feature. It is using the iOS+macOS (native, not Catalyst) template on Xcode 15.1. When compiling for macOS 14.2, everything works as expected. When compiling for iPadOS 17.2, I receive the compiler error message "Cannot find type 'PhotogrammetrySession' in scope".

As minimum deployment target, I selected iOS 17 and macOS 14 (see attachment).

An example of the lines of code causing errors is

import RealityKit

typealias FeatureSensitivity = PhotogrammetrySession.Configuration.FeatureSensitivity
// error: Cannot find type PhotogrammetrySession in scope

typealias LevelOfDetail = PhotogrammetrySession.Request.Detail
// error: Cannot find type PhotogrammetrySession in scope

I made sure to wrap code that uses features unavailable on iOS (e.g. the .raw LOD setting) in #available checks.

Is this an issue with Xcode or am I missing some compatibility check? The SDK clearly says

/// Manages the creation of a 3D model from a set of images.
///
/// For more information on using ``PhotogrammetrySession``, see
/// <doc://com.apple.documentation/documentation/realitykit/creating-3d-objects-from-photographs>.
@available(iOS 17.0, macOS 12.0, macCatalyst 15.0, *)
@available(visionOS, unavailable)
public class PhotogrammetrySession { /* ... */ } 

Thanks for any help with this :)
And greetings from Köln, Germany
~ Alex

Answered by AlexLike in 775945022

Update: Turns out that the code does compile for physical devices running iOS or iPadOS, just not for the simulator. Better error messages would spare me some time debugging in the future xd.

Accepted Answer

Update: Turns out that the code does compile for physical devices running iOS or iPadOS, just not for the simulator. Better error messages would spare me some time debugging in the future xd.

not only this type but also PhotosPickerItem. what to do?

iOS 17: Cannot find type 'PhotogrammetrySession' in scope (Object Capture)
 
 
Q