Is it possible to use ARReferenceImage objects created programatically from the images on iOS 11.3.1

I recently replaced a heavy OpenCV with the native ARKit for image detection and tracking. The images that I want to track downloaded from the web service and stored locally. I'm creating the ARImageReference objects from them using the following code:

    let image = UIImage(contentsOfFile: imageLocalPath),
    let cgImage = image.cgImage
else {
    return nil

return ARReferenceImage(cgImage, orientation: .up, physicalWidth: 0.12)

The width is small, because the images are not so big as well, around 180 x 240 pixels each, but the printed ones may be bigger.

The session configured depending on the current iOS version since ARImageTrackingConfiguration not available for iOS 11:

private lazy var configuration: ARConfiguration = {
    if #available(iOS 12.0, *),
        ARImageTrackingConfiguration.isSupported {
        return ARImageTrackingConfiguration()

    return ARWorldTrackingConfiguration()

if #available(iOS 12.0, *),
    let imagesTrackingConfig = configuration as? ARImageTrackingConfiguration {
    imagesTrackingConfig.trackingImages = referenceImages
} else if let worldTrackingConfig = configuration as? ARWorldTrackingConfiguration {
    worldTrackingConfig.detectionImages = referenceImages
}, options: [.resetTracking, .removeExistingAnchors])

The code above works great for iOS versions 12 and 13 even if I use ARWorldTrackingConfiguration. Images correctly detected by the ARKit. But when I try to run it on iOS 11.3.1, the app immediately crashes with the following error:

Assert: /BuildRoot/Library/Caches/, 62: std::abs(static_cast(aspect_1) - static_cast(src_frame.image.width * output_frame_height_)) < max_slack (lldb)

Is it possible that the dynamic markers creation programmatically is not available for the iOS version below 12.0 or am I doing something wrong? Unfortunately, I wasn't able to find any information regarding the specific versions. Any feedback is appreciated. Thank you.