简体   繁体   English

是否可以将 AppDelegate 添加到独立的 watchOS SwiftUI 应用程序?

[英]Is it possible to add an AppDelegate to an independent watchOS SwiftUI app?

I am trying to add an AppDelegate to a standalone watchOS SwiftUI app (no companion iOS app) as indicated in here , but I can't seem to resolve the issue Cannot find type 'UIApplicationDelegate' in scope我想一个AppDelegate中添加作为表示一个独立的watchOS SwiftUI应用程序(没有随iOS应用) 在这里,但我似乎无法解决问题的范围找不到类型“UIApplicationDelegate”

Explicitly adding an import UIKit does not help.显式添加导入 UIKit 无济于事。

Any clues?有什么线索吗?

https://developer.apple.com/documentation/uikit/uiapplicationdelegate https://developer.apple.com/documentation/uikit/uiapplicationdelegate

UIApplicationDelegate seems to only work with Catalyst, iOS and TvOS. UIApplicationDelegate似乎只适用于 Catalyst、iOS 和 TvOS。 Per WatchKit documentation it using the WKExtensionDelegate that has all the same methods.每WatchKit文档它使用WKExtensionDelegate具有所有的相同方法。

https://developer.apple.com/documentation/watchkit/working_with_the_watchos_app_life_cycle https://developer.apple.com/documentation/watchkit/working_with_the_watchos_app_life_cycle

https://developer.apple.com/documentation/watchkit/wkextensiondelegate https://developer.apple.com/documentation/watchkit/wkextensiondelegate

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

相关问题 WatchOS 上的 SwiftUI 应用程序中是否可以进行基于页面的导航? - Is page-based navigation possible in a SwiftUI app on WatchOS? 在独立的 watchOS 应用上实现核心数据 - Implement Core Data on independent watchOS app 本地通知不适用于独立 WatchOS 应用程序 - Local Notifications not working on independent WatchOS App 如何在 WatchOS 上的 SwiftUI 中为图像添加选取器 - How to add Picker for images in SwiftUI on WatchOS WatchOS 上的 SwiftUI - 用于启动活动或锻炼应用程序的代码? - SwiftUI on WatchOS - code for launching Activity or Workout App? SwiftUI 没有 AppDelegate 的远程推送通知 - 可能吗? - SwiftUI Remote Push Notifications without AppDelegate - Is it Possible? SwiftUI AppDelegate 在打开应用程序时不会运行 - SwiftUI AppDelegate not being ran whenever app is opened 在watchOS中使用.listRowBackground时如何将cornerRadius添加到SwiftUI列表单元? - How to add cornerRadius to SwiftUI List Cell when using .listRowBackground in watchOS? Landmarks SwiftUI 教程 - 创建 watchOS 应用程序 - 导航损坏 - Landmarks SwiftUI Tutorial - Creating watchOS App - Navigation Broken 在 SwiftUI 中点击 watchOS 应用程序时如何更改图像 - How do I change image when tapped on it watchOS app in SwiftUI
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM