I am making an app that uses iBeacon. When the iBeacon is detected (inside AppDelegate), the app detects the phone's coordinates and forwards them to an API.
I have a function called runGPS() set up in ViewController which does the above and am trying to get it to execute when the iBeacon is detected.
When I do ViewController().runGPS(), I get an error: Missing parameter for 'coder' in call
I've looked up this issue and keep going around in circles on resolving it. One correction leads to another error etc. etc. etc.
How does one correct this or is my overall strategy for this wrong?
func locationManager(manager: CLLocationManager,
didEnterRegion region: CLRegion) {
manager.startRangingBeaconsInRegion(region as! CLBeaconRegion)
manager.startUpdatingLocation()
NSLog("You entered the region")
ViewController(NSCoder)!.runGPS()
}