单击本地通知时出现Google FCM ios-quickstart错误 - 无法识别的选择器已发送到实例

时间:2016-06-09 07:18:41

标签: ios firebase localnotification firebase-notifications

来自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];

请帮助我,谢谢你的建议

1 个答案:

答案 0 :(得分:1)

问题在于设置标题。 检查是否已实施alertTitle方法。 检查您为其设置的标题格式。