问题描述
应用没有被杀死 有消息的时候 本地通知怎么操作?杀死后 你们推送过来的 不杀死的发个链接 或截取点代码看看 谢谢
解决方案
demo MainViewController中didReceiveMessage回调,你看下。-(void)didReceiveMessage:(EMMessage *)message{ BOOL needShowNotification = (message.messageType != eMessageTypeChat) ? [self needShowNotification:message.conversationChatter] : YES; if (needShowNotification) {#if !TARGET_IPHONE_SIMULATOR BOOL isAppActivity = [[UIApplication sharedApplication] applicationState] == UIApplicationStateActive; if (!isAppActivity) { [self showNotificationWithMessage:message]; }else { [self playSoundAndVibration]; }#endif }}
时间: 2024-09-20 18:43:02