首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iOS7.1中App被用户终止时的地理围栏

iOS7.1中App被用户终止时的地理围栏
EN

Stack Overflow用户
提问于 2014-03-20 09:29:05
回答 1查看 638关注 0票数 1

在iOS7.1中,当用户杀死一个应用程序时,地理围栏还能工作吗?

如果地理围栏检测到设备正在进入或退出区域,它是否可以触发本地通知(即使用户已经关闭了应用程序)?

EN

回答 1

Stack Overflow用户

发布于 2014-03-20 09:35:29

你的GeoFencing仍然可以工作,它的工作原理就像推送通知/或者存折一样,它仍然会为你的应用生成通知。即使应用程序不在后台运行,bellow函数也会触发。

代码语言:javascript
复制
    - (void)locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region {
    NSString *event = [NSString stringWithFormat:@"didExitRegion %@ at %@",         region.identifier, [NSDate date]];
[self updateWithEvent:event];
     //implement local notification:    
UIApplication *app                = [UIApplication sharedApplication];
UILocalNotification *notification = [[UILocalNotification alloc] init];
[[UIApplication sharedApplication] cancelAllLocalNotifications];

if (notification == nil)
    return;
notification.alertBody = [NSString stringWithFormat:@"Did You Lock Your House?"];
notification.alertAction = @"Lock House";
notification.soundName = UILocalNotificationDefaultSoundName; 
notification.applicationIconBadgeNumber = 1;
[app presentLocalNotificationNow:notification];

[notification release];

}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/22521684

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档