gpt4 book ai didi

iOS App 在 segue 崩溃(断点出现在 func prepareForSegue 处)

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:59:33 24 4
gpt4 key购买 nike

更新:我发现,仅通过阅读代码很难调试,尤其是在这种情况下,https://www.dropbox.com/s/ty3clsvgednzevj/LoaferMap%20for%20iPhone%20copy%202.zip?dl=0 ,所以如果您想重现该错误,我会将我的项目上传到保管箱。我删除了 destination.delete(self),现在它不见了。但是应用程序仍然崩溃。我意识到 SliderViewController 中的问题,也许我编写的代码根本无法执行。我是初学者,是快速编程语言的新手。您的帮助对我来说意义重大。

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 设置经纬度

请这样编辑

enter image description here

关于iOS App 在 segue 崩溃(断点出现在 func prepareForSegue 处),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37982076/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com