Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in location log - Issue #121 #122

Merged
merged 6 commits into from Dec 14, 2015
25 changes: 24 additions & 1 deletion examples/Permissions/Permissions/LocationViewController.swift
Expand Up @@ -12,6 +12,30 @@ import MapKit
import PureLayout
import Operations

/*
Could use this `LocationManager` like this:

```swift
LocationManager.currentUserLocation { print("Got a location: \($0)") }
```
*/
class LocationManager: OperationQueue {

private static let sharedManager = LocationManager()

static var lastUserLocation: CLLocation? = .None

static func currentUserLocation(accuracy: CLLocationAccuracy = kCLLocationAccuracyThreeKilometers, completion: UserLocationOperation.CompletionBlockType) {
let op = UserLocationOperation(accuracy: accuracy) { location in
lastUserLocation = location
completion(location)
}
// Comment out or modify this to adjust how much info is printed out by UserLocationOperation
op.log.severity = .Verbose
sharedManager.addOperation(op)
}
}

class LocationViewController: PermissionViewController {

var mapView: MKMapView!
Expand Down Expand Up @@ -68,7 +92,6 @@ class LocationViewController: PermissionViewController {

func determineAuthorizationStatus() {
let status = GetAuthorizationStatus(Capability.Location(), completion: locationServicesEnabled)
status.log.severity = .Verbose
queue.addOperation(status)
}

Expand Down