作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
if #available(iOS 10.0, *)
{
// For iOS 10 display notification (sent via APNS)
UNUserNotificationCenter.current().delegate = self as? UNUserNotificationCenterDelegate
let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
UNUserNotificationCenter.current().requestAuthorization(
options: authOptions,
completionHandler: {_, _ in })
// For iOS 10 data message (sent via FCM
Messaging.messaging().delegate = (self as! MessagingDelegate)
Couldn't cast value from Appdelegate to FIRMessagingDelegate
最佳答案
你需要在类行中遵守协议(protocol)
class AppDelegate: UIResponder, UIApplicationDelegate,FIRMessagingDelegate {
因为这个转换 (self as!MessagingDelegate)
会崩溃,然后将其替换为
Messaging.messaging().delegate = self
关于ios - 如何处理 Could not cast Appdelegate to FIRMessagingDelegate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56022109/
我是一名优秀的程序员,十分优秀!