Ios 没有用于firmMessage的可见接口。请声明方法setRemoteMessageDelegate

Ios 没有用于firmMessage的可见接口。请声明方法setRemoteMessageDelegate,ios,objective-c,firebase,google-cloud-messaging,firebase-cloud-messaging,Ios,Objective C,Firebase,Google Cloud Messaging,Firebase Cloud Messaging,在这里使用我在appdelegate.m中使用的代码实现了FCM消息传递之后 if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) { UIUserNotificationType allNotificationTypes = (UIUserNotificationTypeSound | UIUserNotificationTypeAlert |

在这里使用我在appdelegate.m中使用的代码实现了FCM消息传递之后

     if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_9_x_Max) {
        UIUserNotificationType allNotificationTypes =
        (UIUserNotificationTypeSound | UIUserNotificationTypeAlert | UIUserNotificationTypeBadge);
        UIUserNotificationSettings *settings =
        [UIUserNotificationSettings settingsForTypes:allNotificationTypes categories:nil];
        [[UIApplication sharedApplication] registerUserNotificationSettings:settings];
    } else {
        // iOS 10 or later
#if defined(__IPHONE_10_0) && __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_10_0
        UNAuthorizationOptions authOptions =
        UNAuthorizationOptionAlert
        | UNAuthorizationOptionSound
        | UNAuthorizationOptionBadge;
        [[UNUserNotificationCenter currentNotificationCenter]
         requestAuthorizationWithOptions:authOptions
         completionHandler:^(BOOL granted, NSError * _Nullable error) {
         }
         ];

        // For iOS 10 display notification (sent via APNS)
        [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
        // For iOS 10 data message (sent via FCM)
        [[FIRMessaging messaging] setRemoteMessageDelegate:self]; // here the method is not defined // 
  #endif
    }
if(楼层(NSFoundationVersionNumber)=\uuuuIphone\u10\u0
未授权选项授权选项=
未授权选项ERT
|未授权选项声音
|未经授权的选择徽章;
[[UNUserNotificationCenter currentNotificationCenter]
requestAuthorizationWithOptions:authOptions
completionHandler:^(BOOL已授予,n错误*\u可为空错误){
}
];
//对于iOS 10显示通知(通过APNS发送)
[[UNUserNotificationCenter currentNotificationCenter]设置委托:self];
//对于iOS 10数据消息(通过FCM发送)
[[FIRMessaging messaging]setRemoteMessageDelegate:self];//此处未定义方法//
#恩迪夫
}
这是appdelegate.h

    //
//  AppDelegate.h
//  lechef
//
//  Created by Zakaria Darwish on 9/5/16.
//  Copyright © 2016 CodeBee. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "constant.h"
#include <AudioToolbox/AudioToolbox.h>
#import "MPGNotification.h"
#include <AudioToolbox/AudioToolbox.h>
#include "constant.h"
@import UserNotifications;
@import GoogleMaps;
@import GooglePlaces;
@import Firebase;
@import FirebaseInstanceID;
@import FirebaseMessaging;

@interface AppDelegate : UIResponder <UIApplicationDelegate,UNUserNotificationCenterDelegate>

@property (strong, nonatomic) UIWindow *window;


@end
//
//AppDelegate.h
//莱切夫
//
//扎卡里亚·达维什于2016年9月5日创作。
//版权所有©2016 CodeBee。保留所有权利。
//
#进口
#导入“常量.h”

#include我无法找出我做错了什么。

我也遇到了同样的错误,但最终还是得到了我的项目来构建。检查你的cocoapods版本(pod--version),确保它是最新的。我正在使用2011年的macbook,显然仍然在使用cocoapods的一个古老(低于1.0.0)版本

在更新ruby、更新cocoapods、取消pod文件中的“use_frameworks!”注释、运行“pod install”和“pod update”之后,错误消失了

# Uncomment this line to define a global platform for your project
# platform :ios, '8.0'
# Uncomment this line if you're using Swift
use_frameworks!

pod 'Firebase/Core'
pod 'Firebase/Messaging'

target 'myappname' do

end

target 'myappnameTests' do

end

当您使用旧版本的云消息时,会发生此错误。请尝试运行:


pod更新--verbose

您成功地使其工作了吗?Firebase工程师,请更新您的文档。我必须弄清楚很多事情—从让导入语句工作到AppDelegate中的每一行。