【问题标题】:FCM push notification error in swift 2.0swift 2.0 中的 FCM 推送通知错误
【发布时间】:2017-02-07 14:39:41
【问题描述】:
if #available(iOS 10.0, *) {
    let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
    UNUserNotificationCenter.current().requestAuthorization(
        options: authOptions,
        completionHandler: {_, _ in }
    )

    // For iOS 10 display notification (sent via APNS)
    UNUserNotificationCenter.current().delegate = self
    // For iOS 10 data message (sent via FCM)
    FIRMessaging.messaging().remoteMessageDelegate = self //ERROR THIS LINE

}
else {
    let settings: UIUserNotificationSettings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
    application.registerUserNotificationSettings(settings)
}

将委托设置为 self 时出错。 "FIRMessing 没有成员 remoteMessageDelegate"

【问题讨论】:

    标签: ios swift firebase firebase-cloud-messaging


    【解决方案1】:

    Google 文档似乎已过期。

    请在终端中运行以下命令:

    pod repo update
    

    然后转到你的项目文件夹并运行

    pod update
    

    (如果对您有帮助,请将此标记为解决方案)

    【讨论】:

      【解决方案2】:

      试试这个:

      class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, FIRMessagingDelegate{
      }
      
      //MARK: FIRMessaging Delegate
      func applicationReceivedRemoteMessage(remoteMessage: FIRMessagingRemoteMessage){  
      }
      

      【讨论】:

        猜你喜欢
        • 2017-02-05
        • 1970-01-01
        • 2017-12-09
        • 2017-07-03
        • 1970-01-01
        • 2020-04-21
        • 2018-06-24
        • 1970-01-01
        • 2020-09-17
        相关资源
        最近更新 更多