更新 Pod 库后 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
您可以将代码更新为如下所示
// With "FirebaseAppDelegateProxyEnabled": NO
- (void)application:(UIApplication *)application
didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
[FIRMessaging messaging].APNSToken = deviceToken;
}
引用here了解更多详情。
关于ios - 'FIRInstanceID' 没有可见的@interface 声明选择器 'setAPNSToken:type:',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53078653/