更新:我发现,仅通过阅读代码很难进行调试,尤其是在这种情况下,https://www.dropbox.com/s/ty3clsvgednzevj/LoaferMap%20for%20iPhone%20copy%202.zip?dl=0 ,所以如果您想重现该错误,我会将我的项目上传到 Dropbox。 我删除了destination.delete(self),现在它消失了。但应用程序仍然崩溃。我意识到 SliderViewController 中的问题,也许我写的代码根本无法执行。我是初学者,不熟悉 Swift 编程语言。您的帮助对我来说意义重大。
If you download my project, and look at it. My goal is actually pretty straightforward, you use a slider to select a travel radius, and there are long lines of code generates a random location based on my current location. And finally pass that code to destinationViewController, to display a flyover animation based on the new generated location. But right now I think everything is set up correctly, but the app still crushes.
当我即将从一个 View 转换到下一个 View 时,我的应用程序崩溃了。
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if (segue.identifier == "sendLocationdata") {
let destination = segue.destinationViewController as! DestinationViewController
Thread 1, Breakpoint 1.1
destination.latitude = latitude
destination.longitude = longitude
}
更多源代码在VC中,下一个VC,可以查看我问的另一个问题How to Pass Data from View Controllers? .
segue.destinationViewController
不是destinationViewController 这个类是一个 UINavigationController
你必须为 UINavigationController 的 rootViewController 设置纬度和经度
请像这样编辑
关于iOS App 在 segue 崩溃(断点发生在 func prepareForSegue),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37982076/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (https://ogeek.cn/) | Powered by Discuz! X3.4 |