打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
关闭App时立即推送一条通知
AppDelegate.m
#pragma mark -- 关闭APP时执行此方法
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
[[EaseMob sharedInstance] applicationWillTerminate:application];
UILocalNotification *noti = [[UILocalNotification alloc] init];
if (noti) {
//设置时区
noti.timeZone = [NSTimeZone defaultTimeZone];
//设置重复间隔
noti.repeatInterval = 0;
//推送声音
noti.soundName = UILocalNotificationDefaultSoundName;
//内容
noti.alertBody = @"为了保证定位服务正常运行,请运行程序并保持在后台运行!";
//设置userinfo 方便在之后需要撤销的时候使用
NSDictionary *infoDic = [NSDictionary dictionaryWithObject:@"name" forKey:@"key"];
noti.userInfo = infoDic;
//立即触发一个通知
[[UIApplication sharedApplication] presentLocalNotificationNow:noti];
}
}
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
IOS开发中本地消息推送方法
苹果13在哪设置关闭APP的推送通知
互动吧APP如何关闭消息推送通知
iOS9新增功能
IOS 本地和远程推送通知详解
iOS推送之远程推送
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服