我们如何注册多平台应用程序以在 iOS 14 中接收通知?
How do we register a Multiplatform App to receive notifcations in iOS 14?
在iOS主应用如下:
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
AppDelegate 不再属于 Multiplatform 应用程序项目类型,我们如何注册应用程序以接收通知并注册移动设备?
我知道如何在 AppDelegate 中完成,但没有 AppDelegate,我不知道如何注册通知。
如有任何帮助,我们将不胜感激!
查看 UIApplicationDelegateAdaptor,它与 NS* 等效。他们让您提供一个 class 将用作应用程序委托。示例:https://www.hackingwithswift.com/quick-start/swiftui/what-is-the-uiapplicationdelegateadaptor-property-wrapper
在iOS主应用如下:
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
}
}
}
AppDelegate 不再属于 Multiplatform 应用程序项目类型,我们如何注册应用程序以接收通知并注册移动设备?
我知道如何在 AppDelegate 中完成,但没有 AppDelegate,我不知道如何注册通知。
如有任何帮助,我们将不胜感激!
查看 UIApplicationDelegateAdaptor,它与 NS* 等效。他们让您提供一个 class 将用作应用程序委托。示例:https://www.hackingwithswift.com/quick-start/swiftui/what-is-the-uiapplicationdelegateadaptor-property-wrapper