小编Nic*_*ong的帖子

iOS10,Swift 3和FCM委托错误

我收到错误:

"Value of type FIRMessaging has no member 'remoteMessageDelegate'" on FIRMessaging.messaging().remoteMessageDelegate = self
Run Code Online (Sandbox Code Playgroud)

我从FCM设置指南中获取此代码段:

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
    // Override point for customization after application launch.

    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 //Get error on …
Run Code Online (Sandbox Code Playgroud)

ios firebase swift firebase-cloud-messaging

5
推荐指数
2
解决办法
2537
查看次数

标签 统计

firebase ×1

firebase-cloud-messaging ×1

ios ×1

swift ×1