所以我有一个问题,只有和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>
</>
);
}来自设备的错误:
特定于
应用程序的信息:NSInvalidArgumentException类型为NSException *终止应用程序的未完全异常的dyld4配置:dyld4终止原因:‘* -__NSPlaceholderArray initWithObjects:count::尝试从名为CoreSimulator 783.5的对象中插入零对象()-设备: iPhone 13 (D63AEBAD-4484-8F91-259 CAEA4FC7F)-运行时: iOS 15.2 (19C51) - DeviceType: 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发布于 2022-02-10 14:22:03
我终于找到了解决这个问题的方法,结果我的模拟器运行的是ios 15.2崩溃。当我在这个版本下面下载另一个版本的时候。我的例子是13.5。它终于起作用了:)
https://stackoverflow.com/questions/70924503
复制相似问题