【问题标题】:iOS Simulator crashes when clicking on MapiOS 模拟器在点击地图时崩溃
【发布时间】:2022-03-08 04:20:00
【问题描述】:

所以我有一个问题只有适用于 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>
        </>
    );
}

来自设备的错误:

应用特定信息: dyld4 配置:DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot 以 NSException 类型的未捕获异常终止 *** 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“*** -[__NSPlaceholderArray initWithObjects:count:]:尝试从对象 [0] 插入 nil 对象” 中止()调用 CoreSimulator 783.5 - 设备:iPhone 13 (D63AEBAD-44FF-4884-8F91-259CAEA4FC7F) - 运行时:iOS 15.2 (19C51) - 设备类型:iPhone 13

Podfile:

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

【问题讨论】:

    标签: react-native dictionary mapbox mapbox-ios


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-28
      • 2021-08-27
      • 2011-12-09
      • 2013-09-27
      • 1970-01-01
      相关资源
      最近更新 更多