简体   繁体   English

MkMapView 崩溃 iOS

[英]MkMapView Crash iOS

I am using SnapKit and programmatically adding a MkMapview.我正在使用 SnapKit 并以编程方式添加 MkMapview。 Every time i background the application it is crashing with this exception - std::__1::system_error: mutex lock failed: Invalid argument每次我后台运行应用程序时,它都会因此异常而崩溃 - std::__1::system_error: mutex lock failed: Invalid argument

I am aware of having to deallocate your delegate, but at this point I haven't even set the delegate and it still crashing.我知道必须取消分配您的委托,但此时我什至还没有设置委托并且它仍然崩溃。

I'm sure it is the map because if I comment out the part where I am adding my map to the view, there is no crash.我确定它是 map,因为如果我注释掉我将 map 添加到视图的部分,则不会发生崩溃。 I have also commented out any code with the map so it is simply displaying a map and crashing on the background.我还用 map 注释掉了所有代码,因此它只是显示 map 并在后台崩溃。 I don't think there's any relevant code to add but this我不认为有任何相关的代码可以添加但是这个

self.view.addSubview(self.map)

where self is an UIView and map is MkMapView.其中 self 是 UIView 和 map 是 MkMapView。

Any suggestions?有什么建议么?

Even though it was posted 9 months ago, I found the solution (workaround..) to this problem.尽管它是 9 个月前发布的,但我找到了解决此问题的方法(解决方法..)。 I was having crashes with my app when entering background with a mapview and attached to a debugger.当使用 mapview 进入后台并附加到调试器时,我的应用程序崩溃了。

It seems that the mapkit uses some Metal API and there might be some problems underneath.似乎 mapkit 使用了一些 Metal API 并且下面可能存在一些问题。 You have to disable runtime Metal API checking and it won't crash.您必须禁用运行时 Metal API 检查,它不会崩溃。

Go to your target settings and under the 'Diagnostics' tab, uncheck the 'API Validation' on the Metal section. Go 到您的目标设置并在“诊断”选项卡下,取消选中“金属”部分的“API 验证”。

Make sure you've requested location permissions with Core Location.确保您已使用 Core Location 请求位置权限。 I had this crash before authentication, then i granted permission and it no longer crashed.我在身份验证之前遇到了这个崩溃,然后我授予了权限并且它不再崩溃了。 Weird and definitely a bug as of iOS 14 but...从 iOS 14 开始很奇怪而且绝对是一个错误但是......

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM