7/04/2014

Behavior of the monitoring region by CLLocationManager

In document

- (void)startMonitoringForRegion:(CLRegion *)region
If an existing region with the same identifier is already being monitored by the application, the old region is replaced by the new one. The regions you add using this method are shared by all location manager objects in your application and stored in the monitoredRegions property.
CLLocationManager manage regions with not equivalence of instance but equivalence of identifier.
And it's surprise for me that sharing regions with instances.


ドキュメントによれば
同じ identifier の region の監視を開始すると、古いものが新しいもので置き換えられる。
インスタンスの同一性ではなく、identifier の同値性で管理されるらしい。
また、監視を開始した region はアプリ内の全ての CLLocationManager で共有されて monitoredRegions プロパティに保存される。
インスタンス間で監視中の region が共有されるのは意外だった。

No comments:

Post a Comment