Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/121.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 调试libc++;abi.dylib:终止时出现std::runtime\u错误类型的未捕获异常_Ios_Swift_React Native - Fatal编程技术网

Ios 调试libc++;abi.dylib:终止时出现std::runtime\u错误类型的未捕获异常

Ios 调试libc++;abi.dylib:终止时出现std::runtime\u错误类型的未捕获异常,ios,swift,react-native,Ios,Swift,React Native,我有一个Swift应用程序,它包括一个ARScnView,一个叠在上面的WebView,然后是一个叠在上面的ReactView。现在我的问题是:每5次重建/启动中就有1次(无所谓),我会收到一个终止崩溃,并显示以下消息: libc++abi.dylib:以std::runtime\u error类型的未捕获异常终止 在日志中绝对找不到更多信息。不管我是在模拟器上运行应用程序还是在实际的iPhone上运行应用程序。据我所知,metro bundler尝试加载本地react native bundl

我有一个Swift应用程序,它包括一个
ARScnView
,一个叠在上面的WebView,然后是一个叠在上面的ReactView。现在我的问题是:每5次重建/启动中就有1次(无所谓),我会收到一个终止崩溃,并显示以下消息:

libc++abi.dylib:以std::runtime\u error类型的未捕获异常终止

在日志中绝对找不到更多信息。不管我是在模拟器上运行应用程序还是在实际的iPhone上运行应用程序。据我所知,metro bundler尝试加载本地react native bundle时会发生错误。由于调试原因,我延迟加载应用程序的每个组件。这是我的
ViewController.swift

//
//  SceneViewRenderer.swift
//  realnote_app
//
//  Created by RealNote on 02.09.20.
//  Copyright © 2020 Facebook. All rights reserved.
//

import Foundation
import UIKit
import ARKit
import WebKit
import Vision

@objc
class ViewController: UIViewController, ARSCNViewDelegate, ARSessionDelegate, RCTBridgeDelegate {
  func sourceURL(for bridge: RCTBridge!) -> URL! {
    return Bundle.main.url(forResource: "main", withExtension: "jsbundle")
  }
  
  
  @IBOutlet weak var sceneView: ARSCNView!
  var webView: WKWebView!
  var webViewManager: WebViewManager!
  var rootView : RCTRootView?
  
  var bridge : RCTBridge?
  
  var interpreterReady = true
  var startTime = Date()
  var endTime = Date()
  var lastCameraImage : UIImage?
  
  let TAG = "ViewController"
  
  override func viewDidLoad() {
    super.viewDidLoad()
    UIApplication.shared.isIdleTimerDisabled = true
    DispatchQueue.main.asyncAfter(deadline: .now() + 4) {
      self.initReactView()
      DispatchQueue.main.asyncAfter(deadline: .now() + 10) {
        self.initWebView()
        let screenWidth = UIScreen.main.bounds.width
        let screenHeight = UIScreen.main.bounds.height
      }
    }
    
    configureLighting()
    addTapGestureToSceneView()
  }
  
  func initWebView() {
    self.webViewManager = WebViewManager(hostViewController: self)
    webView = webViewManager.webView
    
    self.view.insertSubview(webView, aboveSubview: sceneView!)
  }
  
  func initReactView() {
    bridge = RCTBridge(delegate: self, launchOptions: nil)
    rootView = RCTRootView(
      bridge: bridge!,
      moduleName: "realnote",
      initialProperties: nil)
    rootView!.frame = UIScreen.main.bounds
    rootView!.contentView.backgroundColor = UIColor.clear
    
    
    rootView!.backgroundColor = UIColor.clear
    self.view.insertSubview(rootView!, aboveSubview: sceneView)
  }
  
  override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    setUpSceneView()
  }
  
  override func viewWillDisappear(_ animated: Bool) {
    super.viewWillDisappear(animated)
    sceneView.session.pause()
  }
  
  func setUpSceneView() {
    let configuration = ARWorldTrackingConfiguration()
    configuration.planeDetection = [.horizontal, .vertical]
    sceneView.delegate = self
    sceneView.session.delegate = self
    
    sceneView.session.run(configuration)
    
    sceneView.session.delegate = self
    sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints]
    sceneView.isPlaying = true
    HostARInterface.instance.session = sceneView.session
  }
  
  func configureLighting() {
    sceneView.autoenablesDefaultLighting = true
    sceneView.automaticallyUpdatesLighting = true
  }
  
  func session(_ session: ARSession, didUpdate: ARFrame) {
  }
  
  @objc func tapDelegate(withGestureRecognizer recognizer: UIGestureRecognizer) {
    print("tapped")
  }
  
  @objc func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
    // 1
    guard let planeAnchor = anchor as? ARPlaneAnchor else { return }
    
    // 2
    let width = CGFloat(planeAnchor.extent.x)
    let height = CGFloat(planeAnchor.extent.z)
    let plane = SCNPlane(width: width, height: height)
    
    // 3
    plane.materials.first?.diffuse.contents = UIColor.transparentLightBlue
    
    // 4
    let planeNode = SCNNode(geometry: plane)
    
    // 5
    let x = CGFloat(planeAnchor.center.x)
    let y = CGFloat(planeAnchor.center.y)
    let z = CGFloat(planeAnchor.center.z)
    planeNode.position = SCNVector3(x,y,z)
    planeNode.eulerAngles.x = -.pi / 2
    
    // 6
    node.addChildNode(planeNode)
    sceneView.scene.rootNode.addChildNode(planeNode)
  }
  
  
  @objc func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor) {
    // 1
    guard let planeAnchor = anchor as?  ARPlaneAnchor,
          let planeNode = node.childNodes.first,
          let plane = planeNode.geometry as? SCNPlane
    else { return }
    
    // 2
    let width = CGFloat(planeAnchor.extent.x)
    let height = CGFloat(planeAnchor.extent.z)
    plane.width = width
    plane.height = height
    
    // 3
    let x = CGFloat(planeAnchor.center.x)
    let y = CGFloat(planeAnchor.center.y)
    let z = CGFloat(planeAnchor.center.z)
    planeNode.position = SCNVector3(x, y, z)
  }
}

extension float4x4 {
  var translation: float3 {
    let translation = self.columns.3
    return float3(translation.x, translation.y, translation.z)
  }
}

extension UIColor {
  open class var transparentLightBlue: UIColor {
    return UIColor(red: 90/255, green: 200/255, blue: 250/255, alpha: 0.50)
  }
}

extension DispatchQueue {
  
  static func background(delay: Double = 0.0, background: (()->Void)? = nil, completion: (() -> Void)? = nil) {
    DispatchQueue.global(qos: .background).async {
      background?()
      if let completion = completion {
        DispatchQueue.main.asyncAfter(deadline: .now() + delay, execute: {
          completion()
        })
      }
    }
  }
  
}
我的故事板是这样的:

<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="16097.3" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
    <device id="retina4_7" orientation="portrait" appearance="light"/>
    <dependencies>
        <deployment identifier="iOS"/>
        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
        <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
    </dependencies>
    <scenes>
        <!--View Controller-->
        <scene sceneID="tne-QT-ifu">
            <objects>
                <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="realnote_app" customModuleProvider="target" sceneMemberID="viewController">
                    <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                        <subviews>
                            <arscnView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jI8-gS-dO0">
                                <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
                            </arscnView>
                        </subviews>
                        <color key="backgroundColor" red="1" green="1" blue="1" alpha="0" colorSpace="custom" customColorSpace="sRGB"/>
                        <constraints>
                            <constraint firstAttribute="bottom" secondItem="jI8-gS-dO0" secondAttribute="bottom" id="3wb-AZ-jLX"/>
                            <constraint firstAttribute="trailing" secondItem="jI8-gS-dO0" secondAttribute="trailing" id="HJF-UU-dvq"/>
                            <constraint firstItem="jI8-gS-dO0" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="Spv-M6-qle"/>
                            <constraint firstItem="jI8-gS-dO0" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="hh2-WY-86N"/>
                        </constraints>
                        <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
                    </view>
                    <connections>
                        <outlet property="sceneView" destination="jI8-gS-dO0" id="oTc-r2-wcA"/>
                    </connections>
                </viewController>
                <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
            </objects>
            <point key="canvasLocation" x="136.80000000000001" y="133.5832083958021"/>
        </scene>
    </scenes>
</document>

由于这不是经常讨论的
libc++abi.dylib:以NSException(lldb)类型的未捕获异常终止
-错误,因此我完全不知道如何调试或消除它。请注意,在4/5次运行时,应用程序的行为完全符合预期,反应自然,一切工作都像一个符咒