简体   繁体   English

当应用程序在设备上的 Xcode 中运行时,MKMapView 使应用程序崩溃,但如果通过应用程序图标点击在设备上运行则不会

[英]MKMapView crashes the app when app is run in Xcode on a device but not if running on device by application icon tap

I have this case where I implemented MKMapView in .xib file.我有这种情况,我在 .xib 文件中实现了 MKMapView。 I connected IBOutlet in class with MKMapView in .xib file.我在课堂上将 IBOutlet 与 .xib 文件中的 MKMapView 连接起来。 iOS on device is 8.3.设备上的 iOS 是 8.3。 When app is build and run by Xcode on device, it crashes when I open view controller with MKMapView, but it doesn't crash if I run the application on tap on it's icon on the device.当应用程序在设备上由 Xcode 构建和运行时,当我使用 MKMapView 打开视图控制器时它会崩溃,但如果我在设备上点击它的图标运行应用程序,它不会崩溃。 I get no exception or error in log.我在日志中没有发现异常或错误。 It's only breaks at main.它只是在主要中断。 I commented code for MKMapView IBOutlet but nothing changes, only if I remove MKMapView from .xib file crash is gone.我评论了 MKMapView IBOutlet 的代码,但没有任何变化,只有当我从 .xib 文件中删除 MKMapView 时,崩溃才会消失。 Code is written in Swift.代码是用 Swift 编写的。 How to fix this?如何解决这个问题? Thanks for your help.谢谢你的帮助。

Hope these points may help:希望以下几点能有所帮助:

  1. You can try to run it in Release mode , If there there is any breakpoints issue.您可以尝试在 Release 模式下运行它,如果有任何断点问题。
  2. You can check whether you are assigning delegates to the owner or not.您可以检查是否将委托分配给所有者。

我有同样的问题,但我解决了它,将 mapkit.framework 添加到项目中。

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

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