Vra*_*das 11 objective-c geolocation cllocationmanager ios
我为我的应用设置了(默认iOS8)基于位置的通知.
UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.regionTriggersOnce = NO;
notification.userInfo = @{ @"notification_id" : @"someID" };
notification.region = region;
notification.alertBody = alertBody;
[[UIApplication sharedApplication] scheduleLocalNotification:notification];
Run Code Online (Sandbox Code Playgroud)
当用户进入指定区域时,通知将NotificationCenter正确显示.
但是,我想在用户退出该区域时删除该通知消息,因为用户回家并查看通知中心直到他们收到如下所示的消息是没有意义的:
"你在XXXXX!"
有没有人尝试类似的东西?文档不清楚如何做到这一点.
这将从通知中心清除应用程序的所有通知。
[[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0];
[[UIApplication sharedApplication] cancelAllLocalNotifications];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
873 次 |
| 最近记录: |