0

在 iOS 上,主应用程序如下:

@main
struct MyApp: App {
    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

AppDelegate 不再属于 Multiplatform app 项目类型,我们如何注册应用以接收通知并注册移动设备?

我知道如何在 AppDelegate 中做到这一点,但是没有 AppDelegate,我不知道如何注册通知。

任何帮助将不胜感激!

4

1 回答 1

2

查看 UIApplicationDelegateAdaptor 和它的 NS* 等价物。它们让您提供一个将用作应用程序委托的类。示例:https ://www.hackingwithswift.com/quick-start/swiftui/what-is-the-uiapplicationdelegateadaptor-property-wrapper

于 2020-07-02T00:26:11.363 回答