iOS模拟器在点击地图时崩溃



所以我有一个问题只有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 config: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对象"已调用abort((CoreSimulator 783.5-设备:iPhone 13(D63AEBAD-44FF-4884-8F91-259CAEA4FC7F(-运行时:iOS 15.2(19C51(-设备类型: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。它终于起作用了:(

最新更新