Skip to content

Always crash on iOS15.2 #117

Description

@kobeli

About
Always crash on iOS15.2.

Image

`
class DebugARCoreViewController: BaseViewController {
private var garSession: GARSession?

    private var arSession: ARSession?

    private lazy var arSessionConfiguration: ARWorldTrackingConfiguration = {
        let configuration = ARWorldTrackingConfiguration()
        configuration.worldAlignment = .gravity
        return configuration
    }()

    private var scene: SCNScene?

    private var garFrame: GARFrame?

    private var lastStartLocalizationDate: Date?

    private lazy var arLocationResultArray: [[String]] = .init()

    private var greatAccuracyData: ARCoreLocation?

    private var csvFilePath: URL?

    override func viewDidLoad() {
        super.viewDidLoad()
        Log.debug("viewDidLoad")
        isNavigationBarHidden = true
        isSupportScrollToBack = false

        configUI()
        requestCameraAccess()
    }

    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)
        Log.debug("viewDidAppear")
        setUpARSession()
        if NPLocationProvider.checkPermission() {
            setUpGARSession()
        }
    }

    private func setUpARSession() {
        Log.debug("start setUpARSession")

        arSession?.delegate = self
        // Start AR session - this will prompt for camera permissions the first time.
        arSession?.run(arSessionConfiguration)
    }

    private func setUpGARSession() {
        Log.debug("start setUpGARSession")
        if garSession != nil {
            return
        }

        do {
            garSession = try GARSession(apiKey: ARParkingConfig.arCoreKey, bundleIdentifier: nil)
            let supportGeospatial = garSession?.isGeospatialModeSupported(GARGeospatialMode.enabled) ?? false
            if !supportGeospatial {
                assertionFailure("GARGeospatialModeEnabled is not supported on this device")
                return
            }
            let configuration = GARSessionConfiguration()
            configuration.geospatialMode = .enabled
            var error: NSError?
            garSession?.setConfiguration(configuration, error: &error)
            if let errorCode = error?.code {
                assertionFailure("Failed to configure GARSession: \(errorCode)")
                return
            }
            Log.debug("setUpGARSession succeed")
            lastStartLocalizationDate = Date()
        } catch {
            Log.error(error.localizedDescription)
        }
    }

    func updateWithGARFrame(garFrame: GARFrame) {
        self.garFrame = garFrame
        guard let camera = self.garFrame?.earth?.cameraGeospatialTransform else { return }
        guard let lastStartLocalizationDate = lastStartLocalizationDate else { return }
    }

`

Environment
Xcode 16.4, Swift5
iPhone SE (2nd generation), iOS15.2
ARCore 1.49.0 via SPM
Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions