Latest 0.1.0
Homepage https://github.com/SellJamHere/SJHLocationManager
License MIT
Platforms ios 7.0, requires ARC
Frameworks CoreLocation
Authors

Stories in Ready

Version
License
Platform

The SJHLocationManager class implements a singleton subclass of CLLocationManager that utilizes location data to handle entering and exiting regions. Standard region handling works best for large regions, but is somewhat lacking when regions are small.

A few points to note in the Apple Documentation.

  1. Monitoring of a region begins immediately after registration. However, do not expect to receive an event right away. Only boundary crossings can generate an event. Thus, if at registration time the user’s location is already inside the region, the location manager does not generate an event. Instead, you must wait for the user to cross the region boundary before an event is generated and sent to the delegate.
  2. Specifically, the user’s location must cross the region boundary, move away from the boundary by a minimum distance, and remain at that minimum distance for at least 20 seconds before the notifications are reported.
  3. You can assume that the minimum distance is approximately 200 meters.
  4. An app can expect to receive the appropriate region entered or region exited notification within 3 to 5 minutes on average, if not sooner.

To facilitate a more accurate region monitoring, any regions added for monitoring are checked each time the location is updated. To facilitate timely region updates, an NSTimer is scheduled. The interval is determined by SJHLocationManager‘s setTimerInterval: method.

CLLocationManagerDelegate

One-to-One One-to-Many
Protocol/Delegate Notification

When location events occur, they can be forwarded to one class through the delegate or broadcast through NSNotificationCenter.

SJHLocationManager implements CLLocationManagerDelegate methods. If SJHLocationManager.delegate is set, its appropriate methods are called. Otherwise notifications are posted to [NSNotificationCenter defaultCenter] when delegate methods are called, using the appropriate notification name constant.

Notifications are received with:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(requestFinishedHandler:) name:kLocationManagerDidUpdateLocation object:nil];

Installation

SJHLocationManager is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SJHLocationManager"

Development Notes

Currently, only CLCircularRegion objects are supported for region tracking.

Author

James Heller, [email protected]

License

SJHLocationManager is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "SJHLocationManager",
    "version": "0.1.0",
    "summary": "A location manager that handles regions through GPS location.",
    "homepage": "https://github.com/SellJamHere/SJHLocationManager",
    "license": "MIT",
    "authors": {
        "James Heller": "[email protected]"
    },
    "source": {
        "git": "https://github.com/SellJamHere/SJHLocationManager.git",
        "tag": "0.1.0"
    },
    "requires_arc": true,
    "platforms": {
        "ios": "7.0"
    },
    "source_files": "SJHLocationManager",
    "public_header_files": "SJHLocationManager/*.h",
    "frameworks": "CoreLocation"
}

Pin It on Pinterest

Share This