Google FCM ios-单击本地通知时出现快速启动错误 - 发送到实例的选择器无法识别
Google FCM ios-quickstart error on click local notification - unrecognized selector sent to instance
从 Google Firebase 控制台推送消息后,推送消息通知显示在 iPhone 设备顶部,然后我单击该消息,Xcode 抛出如下异常:
[UIConcreteLocalNotification setAlertTitle:]: unrecognized selector sent to instance 0x17e1a810
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIConcreteLocalNotification setAlertTitle:]: unrecognized selector sent to instance
这里是这段代码:
//show notification to status bar
UILocalNotification *local_notification = [[UILocalNotification alloc] init];
local_notification.userInfo = userInfo;
local_notification.alertBody = userInfo[@"notification"][@"body"];
local_notification.alertTitle = userInfo[@"notification"][@"title"] ? userInfo[@"notification"][@"title"]: @"VietAir.tv Thông báo";
local_notification.fireDate = [NSDate dateWithTimeIntervalSinceNow:0]; // todo item due date (when notification will be fired). immediately here
[[UIApplication sharedApplication] scheduleLocalNotification:local_notification];
请帮帮我,谢谢你的建议
问题出在设置标题时。
检查它是否实现了 alertTitle
方法。
检查一次您为其设置的标题格式。
从 Google Firebase 控制台推送消息后,推送消息通知显示在 iPhone 设备顶部,然后我单击该消息,Xcode 抛出如下异常:
[UIConcreteLocalNotification setAlertTitle:]: unrecognized selector sent to instance 0x17e1a810
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIConcreteLocalNotification setAlertTitle:]: unrecognized selector sent to instance
这里是这段代码:
//show notification to status bar
UILocalNotification *local_notification = [[UILocalNotification alloc] init];
local_notification.userInfo = userInfo;
local_notification.alertBody = userInfo[@"notification"][@"body"];
local_notification.alertTitle = userInfo[@"notification"][@"title"] ? userInfo[@"notification"][@"title"]: @"VietAir.tv Thông báo";
local_notification.fireDate = [NSDate dateWithTimeIntervalSinceNow:0]; // todo item due date (when notification will be fired). immediately here
[[UIApplication sharedApplication] scheduleLocalNotification:local_notification];
请帮帮我,谢谢你的建议
问题出在设置标题时。
检查它是否实现了 alertTitle
方法。
检查一次您为其设置的标题格式。