首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Iphone >

Creating an iPhone Daemon – Part 三

2012-09-29 
Creating an iPhone Daemon – Part 3This is part three of the blog series “Creating an iPhone Daemon”

Creating an iPhone Daemon – Part 3

This is part three of the blog series “Creating an iPhone Daemon”, for part one please click?this link

In the last part of the series, we created the header file for our DLocationDelegate class, now lets create the implementation file (DLocationDelegate.h)

NSTimer *timer =  [[NSTimertimerWithTimeInterval:1800.0target:selfselector:@selector(startItAgain:)userInfo:nilrepeats:NO] retain];[[NSRunLoop currentRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];

The DLocationDelegate timer is set for 1800.0 seconds, which is 30 minutes. I found that 30 minutes does not drain the battery too much, but still has a good amount of readings just incase your iPhone is lost.

While this will get your DLocationDelegate class setup, we still have one more issue, and that is that the iPhone will go into a hard sleep after a minute of no use. We will fix this in an upcoming tutorial.


热点排行