Symbol Not found - VisionKit

Hello! I'm implementing cropping an object from an image mechanism.

@MainActor static func detectObjectOnImage(image: UIImage) async throws -> UIImage {
        let analyser = ImageAnalyzer()
        let interaction = ImageAnalysisInteraction()
        let configuration = ImageAnalyzer.Configuration([.visualLookUp])
        let analysis = try await analyser.analyze(image, configuration: configuration)
        interaction.analysis = analysis
        return try await interaction.image(for: interaction.subjects)
    }

My app supports iOS 16 and a compiler doesn't complain about the code.However when I run it on simulator with iOS 16, I'm getting "symbol not found" error on the app launch. Does anybody know what can be the issue?

Whole error text:

"dyld[38277]: Symbol not found: _$s9VisionKit13ImageAnalyzerC13AnalysisTypesV12visualLookUpAEvgZ
  Referenced from: <E3213FE9-2686-387F-8D23-55B918A290B0> /Users/olgikrolik/Library/Developer/CoreSimulator/Devices/2C5A8A63-16A7-4682-BA80-0147DEC2A789/data/Containers/Bundle/Application/95839BE7-9AFF-4372-BD6E-608C9F11F9FD/Shooz.app/Shooz
  Expected in:     <3B040F6E-DA05-3024-9109-B4DB221327E7> /Library/Developer/CoreSimulator/Volumes/iOS_20C52/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS 16.2.simruntime/Contents/Resources/RuntimeRoot/System/Library/Frameworks/VisionKit.framework/VisionKit"

.visualLookUp is only available on macOS 14+.

.visualLookUp is only available on iOS 17.0+.

So when you target iOS 16.0, the symbol is undefined in the runtime of the device running iOS 16, but it will be present if you run the simulator at iOS 17 and higher.

https://developer.apple.com/documentation/visionkit/imageanalysisoverlayview/interactiontypes/4161927-visuallookup

You might want to look at https://developer.apple.com/documentation/visionkit/imageanalysisinteraction

https://developer.apple.com/documentation/visionkit/imageanalysisinteraction/interactiontypes

Symbol Not found - VisionKit
 
 
Q