I'm a little confused as to why geofence isn't firing for any device other than the iPhone 5 in the simulator. Is this a bug in XCode Version 6.3.2 or an issue with my code? Here is the code:
import UIKit
import MapKit
import CoreLocation
class DirectionsViewController: UIViewController, MKMapViewDelegate, CLLocationManagerDelegate{
var map: MKMapView?
var manager: CLLocationManager?
var destination: MKMapItem?
convenience init(frame:CGRect, destination:MKMapItem){
self.init(nibName: nil, bundle: nil)
self.destination = destination
self.view.frame = frame
self.map = MKMapView(frame: frame)
self.map!.delegate = self
self.view.addSubview(self.map!)
manager = CLLocationManager()
manager!.delegate = self
manager!.desiredAccuracy = kCLLocationAccuracyBest
manager!.startUpdatingLocation()
self.map?.showsUserLocation = true
map!.setUserTrackingMode(MKUserTrackingMode.Follow, animated: true)
}
func locationManager(manager: CLLocationManager!, didEnterRegion region: CLRegion!) {
if region is CLCircularRegion {
println("Entered")
}
func viewDidAppear(animated: Bool) {
var center: CLLocationCoordinate2D = destination!.placemark.coordinate
var radius: CLLocationDistance = CLLocationDistance(300)
var identifier: String = "Destination"
let region = CLCircularRegion(center: center, radius: radius, identifier: identifier)
manager?.startMonitoringForRegion(region)
}