小编Kal*_*ati的帖子

如何最小化(内存泄漏)ARKit 场景中的应用程序内存单击后退按钮?

单击后退按钮后,如何最小化 ARKit 场景中的应用程序内存消耗?

因为每次在我的 App 中打开 ARview 时,内存使用量都在增加。当我回去时,它不会释放内存,再次打开 ARview 后,内存使用量进一步增加。

class ARViewController: UIViewController, ARSCNViewDelegate {

    override func viewDidLoad() {
        super.viewDidLoad()
        setupScene()
        setupFocusSquare()
    }

    func setupScene() {
        sceneView.delegate = self
        sceneView.session = session
        sceneView.antialiasingMode = .multisampling4X
        sceneView.automaticallyUpdatesLighting = false
        sceneView.preferredFramesPerSecond = 60
        sceneView.contentScaleFactor = 1.3
        enableEnvironmentMapWithIntensity(25.0)
        if let camera = sceneView.pointOfView?.camera {
            camera.wantsHDR = true
            camera.wantsExposureAdaptation = true
            camera.exposureOffset = -1
            camera.minimumExposure = -1
            camera.maximumExposure = 3
        }
    }

    func setupFocusSquare() {
        focusSquare?.isHidden = true
        focusSquare?.removeFromParentNode()
        focusSquare = FocusSquare()
        sceneView.scene.rootNode.addChildNode(focusSquare!)
        textManager.scheduleMessage("TRY …
Run Code Online (Sandbox Code Playgroud)

memory-leaks ios scenekit swift arkit

2
推荐指数
1
解决办法
942
查看次数

标签 统计

arkit ×1

ios ×1

memory-leaks ×1

scenekit ×1

swift ×1