没有可见的'FIRInstanceID'接口@声明选择器'setAPNSToken:type:' [英] No visible @interface for 'FIRInstanceID' declares the selector 'setAPNSToken:type:'

查看:120
本文介绍了没有可见的'FIRInstanceID'接口@声明选择器'setAPNSToken:type:'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

更新Pod库后,在appdelegate.m中出现上述错误

after updating Pod library getting above error in appdelegate.m

- (void)application:(UIApplication*)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken {

    [[FIRInstanceID instanceID] setAPNSToken:deviceToken type:FIRInstanceIDAPNSTokenTypeSandbox];
    NSString *newToken = [deviceToken description];
    newToken = [newToken stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"<>"]];
    newToken = [newToken stringByReplacingOccurrencesOfString:@" " withString:@""];
    NSLog(@"My token is: %@", newToken);

}

推荐答案

已弃用的代码,应尝试使用FIRMessaging

It is deprecated code, you should try with the FIRMessaging

您可以将代码更新为如下形式

You can update your code to look like this

// With "FirebaseAppDelegateProxyEnabled": NO
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
    [FIRMessaging messaging].APNSToken = deviceToken;
}

有关详细信息,请此处.

这篇关于没有可见的'FIRInstanceID'接口@声明选择器'setAPNSToken:type:'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆