title: Can't Use CLLocation(or CLLocationManagerDelegate) in Flutter
body: <p>I'm trying to use CLLocation in swift in my Flutter Project.
  I'm totally newb for Swift and flutter.
  So I followed the example of documentation but I can't find how can I use CLLocation well.</p>
  <p>Here is my code.</p>
  <pre><code>import UIKit
  import Flutter
  import CoreLocation
  
  @UIApplicationMain
  @objc class AppDelegate: FlutterAppDelegate, CLLocationManagerDelegate {
      let locationManager:CLLocationManager!
  
      override func viewWillAppear(_ animated: Bool) {
          super.viewWillAppear(animated)
          determineMyCurrentLocation()
      }
  
      override func application(
          _ application: UIApplication,
          didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
      ) -&gt; Bool {
  
      /.../
  
  
          batteryChannel.setMethodCallHandler({
              (call: FlutterMethodCall, result: @escaping FlutterResult) -&gt; Void in
              switch call.method{
                  case &quot;getSpeed&quot;:
                      result(self.determineMyCurrentLocation())
                  default:
                      result(FlutterMethodNotImplemented)
              }
          })
  
          GeneratedPluginRegistrant.register(with: self)
          return super.application(application, didFinishLaunchingWithOptions: launchOptions)
      }
      func determineMyCurrentLocation() {
          locationManager = CLLocationManager()
          locationManager.delegate = self
          locationManager.desiredAccuracy = kCLLocationAccuracyBest
          locationManager.requestAlwaysAuthorization()
  
          if CLLocationManager.locationServicesEnabled() {
              locationManager.startUpdatingLocation().then((res)=&gt;{
                  return locations[0].speed
              }catch(e){
                  return -1;
              })
          }
      }
  }
  </code></pre>
  <p>And this is the message I got
  <a href="https://i.stack.imgur.com/3Pw3F.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3Pw3F.png" alt="enter image description here" /></a></p>
  <p>Anyone help?</p>