简体   繁体   English

如何设置 SwiftUI 应用程序文件以允许在 WatchOS 6 上部署独立应用程序

[英]How to setup SwiftUI app file to allow independent app to deploy on WatchOS 6

I am attempting to deploy a SwiftUI app to an Apple Watch Series 2 with WatchOS 6.3, from an iPhone running iOS 15. After connecting the device to Xcode and clicking the build button, I get errors that indicate @SceneBuilder , Scene , WindowGroup , and NavigationView are only " only available in application extensions for watchOS 7.0 or newer".我正在尝试从运行 iOS 15 的 iPhone 将 SwiftUI 应用程序部署到带有 WatchOS 6.3 的 Apple Watch Series 2。将设备连接到 Xcode 并单击构建按钮后,我收到指示@SceneBuilderSceneWindowGroupNavigationView仅“仅在 watchOS 7.0 或更高版本的应用程序扩展中可用”。 Is there a way to configure this file (or some other part of the Xcode environment) to enable the app to work with WatchOS 6.3 or lower?有没有办法配置此文件(或 Xcode 环境的其他部分)以使应用程序能够与 WatchOS 6.3 或更低版本一起使用?

See the screenshot below.请参阅下面的屏幕截图。 Thanks!谢谢!

在此处输入图像描述

Please, check out official example: Developing a User Interface with SwiftUI .请查看官方示例: Developing a User Interface with SwiftUI Basically you need to create storyboard-based interface and put a WKHostingController there (see InterfaceController.swift above).基本上你需要创建基于故事板的界面并在那里放置一个WKHostingController (参见上面的 InterfaceController.swift)。 And there you will load SwiftUI view.在那里您将加载 SwiftUI 视图。 You may also look at WWDC 2019 video #219: SwiftUI on watchOS .您还可以在 watchOS 上观看 WWDC 2019 视频 #219:SwiftUI

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

相关问题 是否可以将 AppDelegate 添加到独立的 watchOS SwiftUI 应用程序? - Is it possible to add an AppDelegate to an independent watchOS SwiftUI app? 在独立的 watchOS 应用上实现核心数据 - Implement Core Data on independent watchOS app 本地通知不适用于独立 WatchOS 应用程序 - Local Notifications not working on independent WatchOS App 在独立的 watchOS 应用程序中使用 FCM 时出现问题 - Problem using FCM in an independent watchOS app 在 SwiftUI 中点击 watchOS 应用程序时如何更改图像 - How do I change image when tapped on it watchOS app in SwiftUI WatchOS 上的 SwiftUI - 用于启动活动或锻炼应用程序的代码? - SwiftUI on WatchOS - code for launching Activity or Workout App? 如何设置 Bundle Ids、App Identifiers 和 Provisioning Profiles 以发布使用 SwiftUI 和 XCode 制作的 WatchOs 应用程序? - How to set Bundle Ids, App Identifiers and Provisioning Profiles to publish a WatchOs App made with SwiftUI and XCode? 如何在 SwiftUI WatchOS App 中更改列表的行背景颜色 - How can I change the List's row background color in SwiftUI WatchOS App WatchOS 上的 SwiftUI 应用程序中是否可以进行基于页面的导航? - Is page-based navigation possible in a SwiftUI app on WatchOS? Landmarks SwiftUI 教程 - 创建 watchOS 应用程序 - 导航损坏 - Landmarks SwiftUI Tutorial - Creating watchOS App - Navigation Broken
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM