IOS后台运行
2014-04-01 09:44
155 查看
一、首先。在Info.plist里面添加 Key:Required background modes Value:App registers for location updates - (void)scheduledTimer { UIApplication* app = [UIApplication sharedApplication]; self.backgroundTask = [app beginBackgroundTaskWithExpirationHandler:^{ NSLog(@"applicationD in Background"); }]; //加入定时器,用来控制后台运行时间 NSTimer *runTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(startLocation) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] addTimer:runTimer forMode:NSRunLoopCommonModes]; } - (void)startLocation { NSLog(@"每隔10秒来一次!!!!!"); }
相关文章推荐
- IOS高级开发~开机启动&无限后台运行&监听进程
- iOS 保持程序在后台持续运行
- iOS程序进入后台后仍运行定时器NSTimer
- ios 后台无限运行
- iOS中后台运行
- ios中音乐后台运行方法
- iOS程序进入后台后仍运行定时器NSTimer
- iOS开发之后台运行调用beginBackgroundTaskWithExpirationHandler
- IOS后台运行 之 后台播放音乐
- iOS开发之后台运行
- IOS的后台运行
- ios后台运行
- IOS高级开发~开机启动&无限后台运行&监听进程
- iOS 后台运行
- ios后台运行
- IOS高级开发~开机启动&无限后台运行&监听进程
- 针对iOS的系统App后台运行的方法
- iOS中后台运行
- iOS后台运行