从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方法。
检查一次您要为其设置的标题格式。

关于ios - 单击本地通知时出现Google FCM ios-quickstart错误-无法识别的选择器已发送到实例,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37719264/

10-11 21:18