iOS 单击地图时模拟器崩溃

iOS Simulator crashes when clicking on Map

所以我 只有 与 iOS 的模拟器有问题,我可以在整个应用程序崩溃之前与地图交互大约两秒钟...

当我使用自己的设备时,它工作正常...

这是一个 gif:https://gyazo.com/67a5d7f10586d0368eb631346122867b

这是我的实现:

import React, { useEffect } from "react";
import { StatusBar } from "react-native";
import MapboxGL from "@react-native-mapbox-gl/maps";

function MapScreen() {
    const context = useEquipment();

    // const { deployedEquipment } = context!;

    const defaultCameraCoordinates = {
        latitude: context?.location?.latitude ?? 0,
        longitude: context?.location?.longitude ?? 0,
    };

    return (
        <>
            <StatusBar animated={true} backgroundColor="black" barStyle="dark-content" />
            <MapboxGL.MapView style={styles.map}>
            </MapboxGL.MapView>
        </>
    );
}

设备错误:

Application Specific Information: dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot terminating with uncaught exception of type NSException *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[0]' abort() called CoreSimulator 783.5 - Device: iPhone 13 (D63AEBAD-44FF-4884-8F91-259CAEA4FC7F) - Runtime: iOS 15.2 (19C51) - DeviceType: iPhone 13

播客文件:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'

target 'DigiCatchRN' do
  config = use_native_modules!

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :hermes_enabled => true
  )

  target 'DigiCatchRNTests' do
    inherit! :complete
    # Pods for testing
  end

  pre_install do |installer|
    $RNMBGL.pre_install(installer) #mapbox
  end


  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable the next line.
  use_flipper!()

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

    $RNMBGL.pre_install(installer) # mapbox
  end
end

我终于找到了解决办法,结果是我的模拟器运行ios 15.2 崩溃了。当我下载低于这个版本的另一个版本时。在我的情况下 13.5。终于成功了:)