简体   繁体   English

Landmarks SwiftUI 教程 - 创建 watchOS 应用程序 - 导航损坏

[英]Landmarks SwiftUI Tutorial - Creating watchOS App - Navigation Broken

I'm just doing SwiftUI tutorial and I'm stuck at https://developer.apple.com/tutorials/swiftui/creating-a-watchos-app (section 4, Add the Landmarks List).我只是在做 SwiftUI 教程,我被困在https://developer.apple.com/tutorials/swiftui/creating-a-watchos-app (第 4 节,添加地标列表)。 Everything worked fine till now, navigation links on the watchOS are not working, just nothing happens.到目前为止一切正常,watchOS 上的导航链接无法正常工作,只是没有任何反应。 I found on StackOverflow someone with same problem in comments, but there wasn't any reply.我在 StackOverflow 上发现有人在评论中有同样的问题,但没有任何回复。 ( NavigationLink broken on watchOS? ) Someone said It's broken since watchOS 8.1. watchOS 上的 NavigationLink 坏了? )有人说它从 watchOS 8.1 开始就坏了。 What to do to start the links working?如何启动链接工作? :D :D

Code:代码:

ForEach(filteredLandmarks) { landmark in
                    NavigationLink {
                        LandmarkDetail(landmark: landmark)
                    } label: {
                        LandmarkRow(landmark: landmark)
                    }
                }.navigationTitle("Landmarks")

Project files: https://docs-assets.developer.apple.com/published/d46bb54c0c90d4e01351338f4627245e/15600/CreatingAwatchOSApp.zip项目文件: https ://docs-assets.developer.apple.com/published/d46bb54c0c90d4e01351338f4627245e/15600/CreatingAwatchOSApp.zip

I just ran into the same issue in the live preview.我刚刚在实时预览中遇到了同样的问题。 Digging around I couldn't find a solution, but when I ran the app in the simulator, the links did work.四处挖掘我找不到解决方案,但是当我在模拟器中运行应用程序时,链接确实有效。 This was with Xcode 13.4.1.这是 Xcode 13.4.1。

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

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