从Swift中的另一个类声明AppDelegate Push Notification委托吗?

时间:2019-06-25 06:15:12

标签: swift push-notification firebase-cloud-messaging apple-push-notifications

我正在利用Utilities类的单个实例来显示弹出窗口并请求Push Notifications访问,但是我已将AppDelegate类设为{{1 }}和delegate,因此在用户在注册过程中授予访问权限时,永远不会调用FirebaseMessaging函数,因此在该时间不保存令牌。

在收到新的注册令牌的情况下,我需要将UserNotificationsdidReceiveRegistrationToken用作通知,并保存它。

如何从实用程序类中创建AppDelegatedelegateAppDelegate

不允许声明AppDelegate单例。

实用程序类:

UNUserNotificationCenter.current().delegate

AppDelegate类:

Messaging.messaging().delegate

0 个答案:

没有答案