arcore-ios-sdk icon indicating copy to clipboard operation
arcore-ios-sdk copied to clipboard

Always crash on iOS15.2

Open kobeli opened this issue 6 months ago • 0 comments

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.

kobeli avatar Jun 27 '25 07:06 kobeli