platform :ios, '7.0'
pod "AmbientStatus", "~> 0.1.0"
platform :ios, '7.0'
pod "AmbientStatus/ASLocationMonitor"
首先,将 <ASLocationMonitorDelegate>
添加到您想使用它的任何文件中。
在这样做后,您必须 startMonitoring
用户的交通
ASLocationMonitor *locationMonitor = [ASLocationMonitor sharedInstance]; // create new instance
locationMonitor.delegate = self; // assign the delegate to self
[locationMonitor startMonitoring]; // start monitoring the user's location
在创建了一个新的 sharedInstance
的 ASTransitMonitor 并设置了 delegate
后,您可以可选地实现以下代理,如果您需要的话
- (void)locationMonitor:(ASLocationMonitor *)locationMonitor didEnterNeighborhood:(CLLocation *)location {
// Do something if the user entered within the neighborhood of a location
}
- (void)locationMonitor:(ASLocationMonitor *)locationMonitor didExitNeighborhood:(CLLocation *)location;
// Do something if the user exited the neighborhood they had previously entered
要获取更多信息,请参阅 文档。
由 Rudd Fawcett 开发。您可以在 GitHub 上找到他的所有开源项目。
打开一个问题。我会尽量在 24 小时内回复您。
AmbientStatus 和 ASLocationMonitor 在 MIT 许可证下提供。有关更多信息,请参阅 LICENSE 文件。