gpt4 book ai didi

ios - 在类型 'remoteMessageDelegate' 的对象上找不到属性 'FIRMessaging *'

转载 作者:行者123 更新时间:2023-12-02 05:24:47 27 4
gpt4 key购买 nike

我正在使用一些 Swift 和 FCM 代码,更新 pod 后出现两个错误。我已经进行了研究,但不知道如何解决它。

这是代码:

// For iOS 10 display notification (sent via APNS)
[UNUserNotificationCenter currentNotificationCenter].delegate = self;
// For iOS 10 data message (sent via FCM)
[FIRMessaging messaging].remoteMessageDelegate = self;

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeProd]; error message———> No visible @interface for 'FIRInstanceID' declares the selector 'setAPNSToken:type:'<--error message ends

NSLog(@"deviceToken1 = %@; %@",deviceToken,[[FIRInstanceID instanceID] token]);
}

这是错误消息:

Property 'remoteMessageDelegate' not found on object of type 'FIRMessaging *'

最佳答案

在 5.0.0 版本中,他们删除了 remoteMessageDelegate并将其替换为 delegate :
https://firebase.google.com/support/release-notes/ios#5.0.0
release notes 5.0.0

也是 delegate现在在当前FIRMessaging API文档: https://firebase.google.com/docs/reference/ios/firebasemessaging/api/reference/Classes/FIRMessaging#/c:objc(cs)FIRMessaging(py)delegate

Delegate to handle FCM token refreshes, and remote data messages received via FCM direct channel.

@property (readwrite, nonatomic, nullable) id<FIRMessagingDelegate> delegate;

您可以引用他们的quickstart-ios代码以获取示例用法:
https://github.com/firebase/quickstart-ios/blob/master/messaging/MessagingExample/AppDelegate.m#L36

  // [START set_messaging_delegate]
[FIRMessaging messaging].delegate = self;
// [END set_messaging_delegate]

关于ios - 在类型 'remoteMessageDelegate' 的对象上找不到属性 'FIRMessaging *',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54470715/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com